mirror of
https://github.com/servo/servo.git
synced 2025-08-18 03:45:33 +01:00
Update web-platform-tests to revision 21461a83c51b72bcff82476c1b79a26a194e7bab
This commit is contained in:
parent
ea206034ad
commit
f96f9a1b78
61 changed files with 1372 additions and 376 deletions
|
@ -7,7 +7,7 @@
|
|||
<script src="/IndexedDB/support-promises.js"></script>
|
||||
|
||||
<script type="module">
|
||||
import { testWithArea } from "./helpers/kvs-tests.js";
|
||||
import { testWithArea, testWithAreaNoCleanup } from "./helpers/kvs-tests.js";
|
||||
|
||||
const mustFail = {
|
||||
"set()": area => area.set(1, "value 1"),
|
||||
|
@ -29,7 +29,7 @@ const mustFail = {
|
|||
|
||||
for (const [method, testFn] of Object.entries(mustFail)) {
|
||||
testWithArea(async (area, t) => {
|
||||
const { database, store, version } = area.backingStore;
|
||||
const { database, version } = area.backingStore;
|
||||
const db = await migrateNamedDatabase(t, database, version + 1, () => {});
|
||||
|
||||
const result = testFn(area);
|
||||
|
@ -37,8 +37,8 @@ for (const [method, testFn] of Object.entries(mustFail)) {
|
|||
await promise_rejects(t, "VersionError", result);
|
||||
}, `${method}: upgrading the database must cause a "VersionError" DOMException`);
|
||||
|
||||
testWithArea(async (area, t) => {
|
||||
const { database, store } = area.backingStore;
|
||||
testWithAreaNoCleanup(async (area, t) => {
|
||||
const { database } = area.backingStore;
|
||||
|
||||
// Set up a new database with that name, but with no object stores!
|
||||
// NB: this depends on the fact that createNameDatabase sets the initial version to 1, which is
|
||||
|
@ -47,7 +47,69 @@ for (const [method, testFn] of Object.entries(mustFail)) {
|
|||
|
||||
const result = testFn(area);
|
||||
|
||||
await promise_rejects(t, "NotFoundError", result);
|
||||
}, `${method}: creating a same-named database with no object store must cause a "NotFoundError" DOMException`);
|
||||
await promise_rejects(t, "InvalidStateError", result);
|
||||
}, `${method}: creating a same-named database with no object store must cause an "InvalidStateError" DOMException`);
|
||||
|
||||
testWithAreaNoCleanup(async (area, t) => {
|
||||
const { database } = area.backingStore;
|
||||
|
||||
const db = await createNamedDatabase(t, database, db => {
|
||||
db.createObjectStore("wrongName");
|
||||
});
|
||||
|
||||
const result = testFn(area);
|
||||
|
||||
await promise_rejects(t, "InvalidStateError", result);
|
||||
}, `${method}: creating a same-named database with a single object store with the wrong name must cause an "InvalidStateError" DOMException`);
|
||||
|
||||
testWithAreaNoCleanup(async (area, t) => {
|
||||
const { database, store } = area.backingStore;
|
||||
|
||||
const db = await createNamedDatabase(t, database, db => {
|
||||
db.createObjectStore(store);
|
||||
db.createObjectStore("wrongName");
|
||||
});
|
||||
|
||||
const result = testFn(area);
|
||||
|
||||
await promise_rejects(t, "InvalidStateError", result);
|
||||
}, `${method}: creating a same-named database with more than one object store must cause an "InvalidStateError" DOMException`);
|
||||
|
||||
testWithAreaNoCleanup(async (area, t) => {
|
||||
const { database, store } = area.backingStore;
|
||||
|
||||
const db = await createNamedDatabase(t, database, db => {
|
||||
db.createObjectStore(store, { autoIncrement: true });
|
||||
});
|
||||
|
||||
const result = testFn(area);
|
||||
|
||||
await promise_rejects(t, "InvalidStateError", result);
|
||||
}, `${method}: creating a same-named database the right object store but a bad schema (autoIncrement = true) must cause an "InvalidStateError" DOMException`);
|
||||
|
||||
testWithAreaNoCleanup(async (area, t) => {
|
||||
const { database, store } = area.backingStore;
|
||||
|
||||
const db = await createNamedDatabase(t, database, db => {
|
||||
db.createObjectStore(store, { keyPath: "somekey" });
|
||||
});
|
||||
|
||||
const result = testFn(area);
|
||||
|
||||
await promise_rejects(t, "InvalidStateError", result);
|
||||
}, `${method}: creating a same-named database the right object store but a bad schema (keyPath != null) must cause an "InvalidStateError" DOMException`);
|
||||
|
||||
testWithAreaNoCleanup(async (area, t) => {
|
||||
const { database, store } = area.backingStore;
|
||||
|
||||
const db = await createNamedDatabase(t, database, db => {
|
||||
const s = db.createObjectStore(store);
|
||||
s.createIndex("index", "indexKey");
|
||||
});
|
||||
|
||||
const result = testFn(area);
|
||||
|
||||
await promise_rejects(t, "InvalidStateError", result);
|
||||
}, `${method}: creating a same-named database the right object store but a bad schema (has indices) must cause an "InvalidStateError" DOMException`);
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue