@rotorsoft/act-tck 1.28.0 → 1.28.2

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/index.js CHANGED
@@ -1697,6 +1697,31 @@ var runStoreTck = (options) => {
1697
1697
  expect8(leasedB.find((l) => l.stream === s)).toBeUndefined();
1698
1698
  expect8(leasedB.find((l) => l.stream === other)).toBeDefined();
1699
1699
  });
1700
+ it7("drops the ack of a holder whose lease was taken, and accrues retry per claim", async () => {
1701
+ const s = `claim-stolen-${uid()}`;
1702
+ await store.subscribe([{ stream: s }]);
1703
+ await store.commit(
1704
+ s,
1705
+ [inc(1), inc(2)],
1706
+ make_meta({ stream: s })
1707
+ );
1708
+ const leasedA = await store.claim(100, 0, `wA-${uid()}`, 1);
1709
+ const a = leasedA.find((l) => l.stream === s);
1710
+ expect8(a).toBeDefined();
1711
+ expect8(a.retry).toBe(0);
1712
+ await new Promise((r) => setTimeout(r, 50));
1713
+ const leasedB = await store.claim(100, 0, `wB-${uid()}`, 1e5);
1714
+ const b = leasedB.find((l) => l.stream === s);
1715
+ expect8(b).toBeDefined();
1716
+ expect8(b.retry).toBe(1);
1717
+ const late = await store.ack([{ ...a, at: a.at + 1 }]);
1718
+ expect8(late).toEqual([]);
1719
+ const rows = [];
1720
+ await store.query_streams((r) => rows.push(r), { stream: s });
1721
+ expect8(rows[0]?.at).toBe(a.at);
1722
+ expect8(rows[0]?.retry).toBe(1);
1723
+ expect8(rows[0]?.blocked).toBe(false);
1724
+ });
1700
1725
  it7("supports dual frontiers (lagging + leading)", async () => {
1701
1726
  const s = `claim-dual-${uid()}`;
1702
1727
  await store.subscribe([{ stream: s }]);