@rotorsoft/act-tck 1.41.1 → 1.41.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/store-tck.d.ts.map +1 -1
- package/dist/index.cjs +48 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-tck.d.ts","sourceRoot":"","sources":["../../src/store-tck.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAUV,KAAK,EAIN,MAAM,sBAAsB,CAAC;AAe9B;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;;;;;OASG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IACrC;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC;;;;;;;;;OASG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IACpC;;;;;;;;OAQG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC;;;;;;;OAOG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IACxC;;;;;;;;OAQG;IACH,QAAQ,CAAC,gCAAgC,CAAC,EAAE,OAAO,CAAC;IACpD;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;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AEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;;OAOG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/C;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IACxD;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,iBAAiB,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,WAAW,YAAa,eAAe,KAAG,IAszLtD,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1280,6 +1280,19 @@ var runStoreTck = (options) => {
|
|
|
1280
1280
|
store.commit(s, [inc(1)], make_meta({ stream: s }), 0)
|
|
1281
1281
|
).rejects.toBeInstanceOf(import_act2.ConcurrencyError);
|
|
1282
1282
|
});
|
|
1283
|
+
(0, import_vitest9.it)("treats expectedVersion -1 as an empty stream", async () => {
|
|
1284
|
+
const s = `commit-new-cc-${uid()}`;
|
|
1285
|
+
const [first] = await store.commit(
|
|
1286
|
+
s,
|
|
1287
|
+
[inc(1)],
|
|
1288
|
+
make_meta({ stream: s }),
|
|
1289
|
+
-1
|
|
1290
|
+
);
|
|
1291
|
+
(0, import_vitest9.expect)(first.version).toBe(0);
|
|
1292
|
+
await (0, import_vitest9.expect)(
|
|
1293
|
+
store.commit(s, [inc(1)], make_meta({ stream: s }), -1)
|
|
1294
|
+
).rejects.toBeInstanceOf(import_act2.ConcurrencyError);
|
|
1295
|
+
});
|
|
1283
1296
|
(0, import_vitest9.it)("checks expectedVersion even when committing no events", async () => {
|
|
1284
1297
|
const s = `commit-empty-cc-${uid()}`;
|
|
1285
1298
|
await store.commit(
|
|
@@ -1294,6 +1307,41 @@ var runStoreTck = (options) => {
|
|
|
1294
1307
|
await store.commit(s, [], make_meta({ stream: s }), 0)
|
|
1295
1308
|
).toEqual([]);
|
|
1296
1309
|
});
|
|
1310
|
+
(0, import_vitest9.it)("takes concurrent commits, reads and writes on one instance", async () => {
|
|
1311
|
+
const x = `commit-concurrent-x-${uid()}`;
|
|
1312
|
+
const y = `commit-concurrent-y-${uid()}`;
|
|
1313
|
+
const [first, second, other, read, subscribed] = await Promise.allSettled([
|
|
1314
|
+
store.commit(
|
|
1315
|
+
x,
|
|
1316
|
+
[inc(1)],
|
|
1317
|
+
make_meta({ stream: x }),
|
|
1318
|
+
-1
|
|
1319
|
+
),
|
|
1320
|
+
store.commit(
|
|
1321
|
+
x,
|
|
1322
|
+
[inc(2)],
|
|
1323
|
+
make_meta({ stream: x }),
|
|
1324
|
+
-1
|
|
1325
|
+
),
|
|
1326
|
+
store.commit(y, [inc(1)], make_meta({ stream: y })),
|
|
1327
|
+
store.query(() => {
|
|
1328
|
+
}, { stream: x, stream_exact: true }),
|
|
1329
|
+
// A source nothing writes, so later claims never see it.
|
|
1330
|
+
store.subscribe([
|
|
1331
|
+
{ stream: `${y}-idle`, source: `${y}-no-source` }
|
|
1332
|
+
])
|
|
1333
|
+
]);
|
|
1334
|
+
(0, import_vitest9.expect)(
|
|
1335
|
+
[first, second].filter((r) => r.status === "fulfilled")
|
|
1336
|
+
).toHaveLength(1);
|
|
1337
|
+
const lost = [first, second].find((r) => r.status === "rejected");
|
|
1338
|
+
(0, import_vitest9.expect)(lost.reason).toBeInstanceOf(
|
|
1339
|
+
import_act2.ConcurrencyError
|
|
1340
|
+
);
|
|
1341
|
+
(0, import_vitest9.expect)(other.status).toBe("fulfilled");
|
|
1342
|
+
(0, import_vitest9.expect)(read.status).toBe("fulfilled");
|
|
1343
|
+
(0, import_vitest9.expect)(subscribed.status).toBe("fulfilled");
|
|
1344
|
+
});
|
|
1297
1345
|
(0, import_vitest9.it)("preserves prior events when a concurrent commit is rejected", async () => {
|
|
1298
1346
|
const s = `commit-cc-preserve-${uid()}`;
|
|
1299
1347
|
await store.commit(
|