deno.land / x / replicache@v10.0.0-beta.0 / kv / idb-store.test.ts

idb-store.test.ts
نووسراو ببینە
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
import {runAll, TestStore} from './store-test-util';import {dropStore, IDBStore} from './idb-store';import {expect} from '@esm-bundle/chai';
async function newRandomIDBStore() { const name = `test-idbstore-${Math.random()}`; await dropStore(name); return new IDBStore(name);}
runAll('idbstore', newRandomIDBStore);
test('dropStore', async () => { const name = `drop-store-${Math.random()}`; await dropStore(name); let idb = new IDBStore(name); let store = new TestStore(idb);
// Write a value. await store.withWrite(async wt => { await wt.put('foo', 'bar'); await wt.commit(); });
// Verify it's there. await store.withRead(async rt => { expect(await rt.get('foo')).to.deep.equal('bar'); });
// Drop db await dropStore(name);
// Reopen store, verify data is gone idb = new IDBStore(name); store = new TestStore(idb); await store.withRead(async rt => { expect(await rt.has('foo')).to.be.false; });});
replicache

Version Info

Tagged at
2 years ago