@x5e/gink
Version:
an eventually consistent database
25 lines • 1.23 kB
JavaScript
;
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 store = new implementation_1.IndexedDbStore("IndexedDbStore.test.1");
const database = new implementation_1.Database({ store });
await database.ready;
const dir = implementation_1.Directory.get(database);
await dir.set("foo", "bar");
const beforeSecondSet = (0, implementation_1.generateTimestamp)();
await dir.set("foo", "baz");
const entries = await store.getAllEntries();
(0, implementation_1.ensure)(entries.length === 2);
const removals = await store.getAllRemovals();
(0, implementation_1.ensure)(removals.length === 1);
await store.dropHistory();
const entriesAfterDrop = await store.getAllEntryKeys();
(0, implementation_1.ensure)(entriesAfterDrop.length === 1);
(0, implementation_1.ensure)(!(await dir.has("foo", beforeSecondSet)));
});
//# sourceMappingURL=IndexedDbStore.test.js.map