@rotorsoft/act-tck 1.13.0 → 1.13.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.cjs CHANGED
@@ -706,6 +706,52 @@ var runStoreTck = (options) => {
706
706
  }
707
707
  });
708
708
  });
709
+ (0, import_vitest4.describe)("lease semantics", () => {
710
+ (0, import_vitest4.it)("returns retry=0 on first claim and increments on re-claim without ack", async () => {
711
+ const fresh = await options.factory();
712
+ try {
713
+ await fresh.drop();
714
+ await fresh.seed();
715
+ const s = `lease-retry-${uid()}`;
716
+ await fresh.subscribe([{ stream: s }]);
717
+ await fresh.commit(
718
+ s,
719
+ [inc(1)],
720
+ make_meta({ stream: s })
721
+ );
722
+ const first = await fresh.claim(1, 0, `w-${uid()}`, 0);
723
+ const f = first.find((l) => l.stream === s);
724
+ (0, import_vitest4.expect)(f).toBeDefined();
725
+ (0, import_vitest4.expect)(f.retry).toBe(0);
726
+ const second = await fresh.claim(1, 0, `w-${uid()}`, 1e5);
727
+ const sec = second.find((l) => l.stream === s);
728
+ (0, import_vitest4.expect)(sec).toBeDefined();
729
+ (0, import_vitest4.expect)(sec.retry).toBe(1);
730
+ } finally {
731
+ await fresh.dispose();
732
+ }
733
+ });
734
+ (0, import_vitest4.it)("reports lagging=true from the lagging frontier and false from the leading frontier", async () => {
735
+ const fresh = await options.factory();
736
+ try {
737
+ await fresh.drop();
738
+ await fresh.seed();
739
+ const s = `lease-lag-${uid()}`;
740
+ await fresh.subscribe([{ stream: s }]);
741
+ await fresh.commit(
742
+ s,
743
+ [inc(1)],
744
+ make_meta({ stream: s })
745
+ );
746
+ const lag = await fresh.claim(1, 0, `w-${uid()}`, 0);
747
+ (0, import_vitest4.expect)(lag.find((l) => l.stream === s)?.lagging).toBe(true);
748
+ const lead = await fresh.claim(0, 1, `w-${uid()}`, 1e5);
749
+ (0, import_vitest4.expect)(lead.find((l) => l.stream === s)?.lagging).toBe(false);
750
+ } finally {
751
+ await fresh.dispose();
752
+ }
753
+ });
754
+ });
709
755
  (0, import_vitest4.describe)("block", () => {
710
756
  (0, import_vitest4.it)("hides blocked streams from claim", async () => {
711
757
  const s = `block-${uid()}`;