@rotorsoft/act-tck 1.30.4 → 1.31.0
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 +40 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1759,6 +1759,46 @@ var runStoreTck = (options) => {
|
|
|
1759
1759
|
await store.subscribe([{ stream: s }]);
|
|
1760
1760
|
expect8(await read()).toBe(0);
|
|
1761
1761
|
});
|
|
1762
|
+
describe8("correlate checkpoint", () => {
|
|
1763
|
+
const peek = async () => (await store.subscribe([])).correlated_at;
|
|
1764
|
+
it7("round-trips an advance through subscribe", async () => {
|
|
1765
|
+
const base = await peek();
|
|
1766
|
+
expect8((await store.subscribe([], base + 10)).correlated_at).toBe(
|
|
1767
|
+
base + 10
|
|
1768
|
+
);
|
|
1769
|
+
expect8(await peek()).toBe(base + 10);
|
|
1770
|
+
});
|
|
1771
|
+
it7("persists only when greater than the stored value", async () => {
|
|
1772
|
+
const base = await peek();
|
|
1773
|
+
await store.subscribe([], base - 5);
|
|
1774
|
+
expect8(await peek()).toBe(base);
|
|
1775
|
+
await store.subscribe([], base);
|
|
1776
|
+
expect8(await peek()).toBe(base);
|
|
1777
|
+
await store.subscribe([], base + 3);
|
|
1778
|
+
expect8(await peek()).toBe(base + 3);
|
|
1779
|
+
});
|
|
1780
|
+
it7("is left untouched when subscribe omits it", async () => {
|
|
1781
|
+
const base = await peek();
|
|
1782
|
+
await store.subscribe([]);
|
|
1783
|
+
expect8(await peek()).toBe(base);
|
|
1784
|
+
});
|
|
1785
|
+
it7("advances in the same call that registers discovered targets", async () => {
|
|
1786
|
+
const base = await peek();
|
|
1787
|
+
const s = `cp-sub-${uid()}`;
|
|
1788
|
+
const { subscribed, correlated_at } = await store.subscribe(
|
|
1789
|
+
[{ stream: s }],
|
|
1790
|
+
base + 7
|
|
1791
|
+
);
|
|
1792
|
+
expect8(subscribed).toBe(1);
|
|
1793
|
+
expect8(correlated_at).toBe(base + 7);
|
|
1794
|
+
});
|
|
1795
|
+
it7("is invisible to every stream-scoped surface", async () => {
|
|
1796
|
+
const seen = [];
|
|
1797
|
+
await store.query_streams((p) => seen.push(p.stream), {});
|
|
1798
|
+
expect8(seen.some((n) => n.startsWith("__correlate"))).toBe(false);
|
|
1799
|
+
expect8(seen).not.toContain("correlated");
|
|
1800
|
+
});
|
|
1801
|
+
});
|
|
1762
1802
|
it7("claims a subscribed stream and ack releases the lease", async () => {
|
|
1763
1803
|
const s = `claim-${uid()}`;
|
|
1764
1804
|
await store.subscribe([{ stream: s }]);
|