UNPKG

@x5e/gink

Version:

an eventually consistent database

23 lines 1.26 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const implementation_1 = require("../implementation"); const utils_1 = require("../implementation/utils"); it("bundle.combining", async function () { const store = new implementation_1.IndexedDbStore("bundle combining test", true); const instance = new implementation_1.Database({ store }); await instance.ready; const schema = implementation_1.Directory.get(); // make two changes const changesBeforeTwo = store.getTransactionCount(); await schema.set("key1", "value1"); await schema.set("key2", "value2"); const changesAfterTwo = store.getTransactionCount(); (0, utils_1.ensure)(changesAfterTwo - changesBeforeTwo >= 2, `two:${changesBeforeTwo} => ${changesAfterTwo} `); const changeBeforeCombo = store.getTransactionCount(); const _ = schema.set("first1", "v1", { comment: "first comment" }); const promise2 = schema.set("second2", "v2", { comment: "second comment" }); await promise2; const changesAfterCombo = store.getTransactionCount(); (0, utils_1.ensure)(changesAfterCombo - changeBeforeCombo === 1, `combo ${changeBeforeCombo} => ${changesAfterCombo}`); }); //# sourceMappingURL=combine-bundles.test.js.map