diff options
author | Florian Dold <florian@dold.me> | 2021-02-16 16:45:15 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-02-16 16:45:15 +0100 |
commit | f9df95ded5ba1d6a6edadd24615c5e175ea5bac8 (patch) | |
tree | a7bab6bcb09f865181e86002a526992f17588035 /packages/idb-bridge/src/idb-wpt-ported/idbfactory-cmp.test.ts | |
parent | b814697fc9e4d55fbdb9b60ff82bef0c0c310494 (diff) | |
download | wallet-core-f9df95ded5ba1d6a6edadd24615c5e175ea5bac8.tar.xz |
more WPTs
Diffstat (limited to 'packages/idb-bridge/src/idb-wpt-ported/idbfactory-cmp.test.ts')
-rw-r--r-- | packages/idb-bridge/src/idb-wpt-ported/idbfactory-cmp.test.ts | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/packages/idb-bridge/src/idb-wpt-ported/idbfactory-cmp.test.ts b/packages/idb-bridge/src/idb-wpt-ported/idbfactory-cmp.test.ts new file mode 100644 index 000000000..c7a25a46b --- /dev/null +++ b/packages/idb-bridge/src/idb-wpt-ported/idbfactory-cmp.test.ts @@ -0,0 +1,63 @@ +import test from "ava"; +import { createdb, idbFactory } from "./wptsupport"; + +test("WPT idbfactory-cmp*.html", async (t) => { + const indexedDB = idbFactory; + var greater = indexedDB.cmp(2, 1); + var equal = indexedDB.cmp(2, 2); + var less = indexedDB.cmp(1, 2); + + t.deepEqual(greater, 1, "greater"); + t.deepEqual(equal, 0, "equal"); + t.deepEqual(less, -1, "less"); + + t.throws( + () => { + // @ts-expect-error + indexedDB.cmp(); + }, + { instanceOf: TypeError }, + ); + + t.throws( + () => { + indexedDB.cmp(null, null); + }, + { name: "DataError" }, + ); + + t.throws( + () => { + indexedDB.cmp(1, null); + }, + { name: "DataError" }, + ); + + t.throws( + () => { + indexedDB.cmp(null, 1); + }, + { name: "DataError" }, + ); + + t.throws( + () => { + indexedDB.cmp(NaN, NaN); + }, + { name: "DataError" }, + ); + + t.throws( + () => { + indexedDB.cmp(1, NaN); + }, + { name: "DataError" }, + ); + + t.throws( + () => { + indexedDB.cmp(NaN, 1); + }, + { name: "DataError" }, + ); +}); |