UNPKG

@x5e/gink

Version:

an eventually consistent database

25 lines 1.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.result = void 0; const Store_test_1 = require("./Store.test"); const implementation_1 = require("../implementation"); (0, Store_test_1.testStore)("IndexedDbStore", async () => new implementation_1.IndexedDbStore("IDB.test", true)); exports.result = 1; it("use methods", async () => { const indexedDbStore = new implementation_1.IndexedDbStore("IndexedDbStore.test.1"); const database = new implementation_1.Database(indexedDbStore); await database.ready; const dir = database.getGlobalDirectory(); await dir.set("foo", "bar"); const beforeSecondSet = (0, implementation_1.generateTimestamp)(); await dir.set("foo", "baz"); const entries = await indexedDbStore.getAllEntries(); (0, implementation_1.ensure)(entries.length === 2); const removals = await indexedDbStore.getAllRemovals(); (0, implementation_1.ensure)(removals.length === 1); await indexedDbStore.dropHistory(); const entriesAfterDrop = await indexedDbStore.getAllEntryKeys(); (0, implementation_1.ensure)(entriesAfterDrop.length === 1); (0, implementation_1.ensure)(!(await dir.has("foo", beforeSecondSet))); }); //# sourceMappingURL=IndexedDbStore.test.js.map