@rotorsoft/act-tck 1.30.1 → 1.30.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
@@ -1691,6 +1691,34 @@ var runStoreTck = (options) => {
1691
1691
  await store.subscribe([{ stream: s }]);
1692
1692
  expect8(await read()).toBe(10);
1693
1693
  });
1694
+ it7("does not claim a fresh subscription with no matching events", async () => {
1695
+ const s = `fresh-empty-${uid()}`;
1696
+ const src = `fresh-src-${uid()}`;
1697
+ await store.subscribe([{ stream: s, source: src }]);
1698
+ const leases = await store.claim(5, 5, `w-${uid()}`, 5e3);
1699
+ expect8(leases.filter((l) => l.stream === s)).toHaveLength(0);
1700
+ });
1701
+ it7("claims a fresh subscription as soon as its first event lands", async () => {
1702
+ const s = `fresh-first-${uid()}`;
1703
+ const src = `fresh-first-src-${uid()}`;
1704
+ await store.subscribe([{ stream: s, source: src }]);
1705
+ await store.commit(
1706
+ src,
1707
+ [inc(1)],
1708
+ make_meta({ stream: src })
1709
+ );
1710
+ const leases = await store.claim(5, 5, `w-${uid()}`, 5e3);
1711
+ const mine = leases.filter((l) => l.stream === s);
1712
+ expect8(mine).toHaveLength(1);
1713
+ expect8(mine[0].at).toBe(-1);
1714
+ const in_window = [];
1715
+ await store.query((e) => in_window.push(e), {
1716
+ stream: src,
1717
+ stream_exact: true,
1718
+ after: mine[0].at
1719
+ });
1720
+ expect8(in_window).toHaveLength(1);
1721
+ });
1694
1722
  it7("keeps the maximum for negative and zero priorities too", async () => {
1695
1723
  const s = `sub-pri-neg-${uid()}`;
1696
1724
  const read = async () => {
@@ -2129,12 +2157,8 @@ var runStoreTck = (options) => {
2129
2157
  const first = await fresh.claim(100, 0, `w-${uid()}`, 3e4);
2130
2158
  const l1 = first.find((s) => s.stream === target);
2131
2159
  expect8(l1).toBeDefined();
2132
- const c1 = first.find((s) => s.stream === control);
2133
- expect8(c1).toBeDefined();
2134
- await fresh.ack([
2135
- { ...l1, at: ea.id },
2136
- { ...c1, at: -1 }
2137
- ]);
2160
+ expect8(first.map((s) => s.stream)).not.toContain(control);
2161
+ await fresh.ack([{ ...l1, at: ea.id }]);
2138
2162
  await seed_stream(fresh, other, 1);
2139
2163
  const claimed = await fresh.claim(100, 0, `w-${uid()}`, 3e4);
2140
2164
  const streams = claimed.map((s) => s.stream);