1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
import test from "ava";
import { initTestIndexedDB, useTestIndexedDb } from "./wptsupport.js";
test.before("test DB initialization", initTestIndexedDB);
test("WPT idbfactory-cmp*.html", async (t) => {
const indexedDB = useTestIndexedDb();
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" },
);
});
|