diff options
| author | Florian Dold <florian@dold.me> | 2021-02-08 19:59:19 +0100 |
|---|---|---|
| committer | Florian Dold <florian@dold.me> | 2021-02-08 19:59:19 +0100 |
| commit | 8c92499d85917693d2f87252419f0eeccd239a2b (patch) | |
| tree | 569d0ee1c25d62caf0ac87131ecfa8166d12c62b /packages/idb-bridge/src/idb-wpt-ported/value.test.ts | |
| parent | 5ff5a686e4f15dea839b18fda9275687557d23a7 (diff) | |
idb: add first web platform tests, fix issues detected by them
Diffstat (limited to 'packages/idb-bridge/src/idb-wpt-ported/value.test.ts')
| -rw-r--r-- | packages/idb-bridge/src/idb-wpt-ported/value.test.ts | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/packages/idb-bridge/src/idb-wpt-ported/value.test.ts b/packages/idb-bridge/src/idb-wpt-ported/value.test.ts new file mode 100644 index 000000000..c4a8315c6 --- /dev/null +++ b/packages/idb-bridge/src/idb-wpt-ported/value.test.ts @@ -0,0 +1,46 @@ +import test from "ava"; +import { IDBVersionChangeEvent } from "../idbtypes"; +import { createdb } from "./wptsupport"; + +test.cb("WPT test value.htm, array", (t) => { + const value = new Array(); + const _instanceof = Array; + + t.plan(1); + + createdb(t).onupgradeneeded = function (e: IDBVersionChangeEvent) { + (e.target as any).result.createObjectStore("store").add(value, 1); + (e.target as any).onsuccess = (e: any) => { + console.log("in first onsuccess"); + e.target.result + .transaction("store") + .objectStore("store") + .get(1).onsuccess = (e: any) => { + t.assert(e.target.result instanceof _instanceof, "instanceof"); + t.end(); + }; + }; + }; +}); + +test.cb("WPT test value.htm, date", (t) => { + const value = new Date(); + const _instanceof = Date; + + t.plan(1); + + createdb(t).onupgradeneeded = function (e: IDBVersionChangeEvent) { + (e.target as any).result.createObjectStore("store").add(value, 1); + (e.target as any).onsuccess = (e: any) => { + console.log("in first onsuccess"); + e.target.result + .transaction("store") + .objectStore("store") + .get(1).onsuccess = (e: any) => { + t.assert(e.target.result instanceof _instanceof, "instanceof"); + t.end(); + }; + }; + }; + }); +
\ No newline at end of file |
