@rotorsoft/act-tck 1.36.18 → 1.36.20

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
@@ -2261,6 +2261,36 @@ var runStoreTck = (options) => {
2261
2261
  await fresh.dispose();
2262
2262
  }
2263
2263
  });
2264
+ it7("records the lease holder for a zero-length lease, so its ack lands", async () => {
2265
+ const fresh = await options.factory();
2266
+ try {
2267
+ await fresh.drop();
2268
+ await fresh.seed();
2269
+ const s = `lease-zero-${uid()}`;
2270
+ await fresh.subscribe([{ stream: s }]);
2271
+ const [committed] = await fresh.commit(
2272
+ s,
2273
+ [inc(1)],
2274
+ make_meta({ stream: s })
2275
+ );
2276
+ await correlate(fresh);
2277
+ const leased = await fresh.claim(1, 0, `w-${uid()}`, 0);
2278
+ const mine = leased.find((l) => l.stream === s);
2279
+ expect8(mine).toBeDefined();
2280
+ const acked = await fresh.ack([{ ...mine, at: committed.id }]);
2281
+ expect8(acked).toHaveLength(1);
2282
+ let at = -1;
2283
+ await fresh.query_streams(
2284
+ (p) => {
2285
+ at = p.at;
2286
+ },
2287
+ { stream: s, stream_exact: true }
2288
+ );
2289
+ expect8(at).toBe(committed.id);
2290
+ } finally {
2291
+ await fresh.dispose();
2292
+ }
2293
+ });
2264
2294
  it7("reports lagging=true from the lagging frontier and false from the leading frontier", async () => {
2265
2295
  const fresh = await options.factory();
2266
2296
  try {
@@ -3653,6 +3683,25 @@ var runStoreTck = (options) => {
3653
3683
  }
3654
3684
  expect8([...visited].sort()).toEqual([...names].sort());
3655
3685
  });
3686
+ it7("limit: 0 returns no rows", async () => {
3687
+ const s = `qs-zero-${uid()}`;
3688
+ await store.subscribe([{ stream: s }]);
3689
+ const seen = [];
3690
+ const push = (p) => {
3691
+ seen.push(p.stream);
3692
+ };
3693
+ const filter = { stream: s, stream_exact: true };
3694
+ const control = await store.query_streams(push, filter);
3695
+ expect8(control.count).toBe(1);
3696
+ expect8(seen).toEqual([s]);
3697
+ seen.length = 0;
3698
+ const { count } = await store.query_streams(push, {
3699
+ ...filter,
3700
+ limit: 0
3701
+ });
3702
+ expect8(seen).toEqual([]);
3703
+ expect8(count).toBe(0);
3704
+ });
3656
3705
  it7("returns positions filtered by stream regex, exact, source, and source_exact", async () => {
3657
3706
  const tag = uid();
3658
3707
  const proj1 = `qs-${tag}-projection-tickets`;
@@ -3790,6 +3839,21 @@ var runStoreTck = (options) => {
3790
3839
  const unknown = await store.query_stats([`qst-${tag}-missing`]);
3791
3840
  expect8(unknown.size).toBe(0);
3792
3841
  });
3842
+ it7("limit: 0 returns no rows", async () => {
3843
+ const s = `qst-zero-${uid()}`;
3844
+ await store.commit(
3845
+ s,
3846
+ [inc(1)],
3847
+ make_meta({ stream: s })
3848
+ );
3849
+ const filter = { stream: s, stream_exact: true };
3850
+ const control = await store.query_stats(filter);
3851
+ expect8(control.size).toBe(1);
3852
+ const stats = await store.query_stats(filter, {
3853
+ limit: 0
3854
+ });
3855
+ expect8(stats.size).toBe(0);
3856
+ });
3793
3857
  it7("keyset pagination visits every stream regardless of name case (#1357)", async () => {
3794
3858
  const tag = uid();
3795
3859
  const names = [