@rotorsoft/act-tck 1.38.9 → 1.38.11

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
@@ -1116,7 +1116,7 @@ import {
1116
1116
  TOMBSTONE_EVENT,
1117
1117
  ValidationError
1118
1118
  } from "@rotorsoft/act";
1119
- import { afterAll as afterAll4, beforeAll as beforeAll4, describe as describe8, expect as expect8, it as it7 } from "vitest";
1119
+ import { afterAll as afterAll4, beforeAll as beforeAll4, describe as describe8, expect as expect8, it as it7, vi } from "vitest";
1120
1120
  var runStoreTck = (options) => {
1121
1121
  describe8(`TCK / Store / ${options.name}`, () => {
1122
1122
  let store;
@@ -2607,6 +2607,30 @@ var runStoreTck = (options) => {
2607
2607
  expect8(leased.find((l) => l.stream === ctl)).toBeDefined();
2608
2608
  expect8(leased.find((l) => l.stream === s)).toBeUndefined();
2609
2609
  });
2610
+ it7("judges deferred_at by the claiming worker's clock", async () => {
2611
+ const s = `defer-clock-${uid()}`;
2612
+ await store.subscribe([{ stream: s }]);
2613
+ await store.commit(
2614
+ s,
2615
+ [inc(1)],
2616
+ make_meta({ stream: s })
2617
+ );
2618
+ expect8(await store.defer([s], Date.now() + 6e4)).toBe(1);
2619
+ await correlate();
2620
+ vi.useFakeTimers({
2621
+ toFake: ["Date"],
2622
+ shouldAdvanceTime: true,
2623
+ now: Date.now() + 12e4
2624
+ });
2625
+ try {
2626
+ const leased = await store.claim(100, 100, `w-${uid()}`, 1);
2627
+ const mine = leased.find((l) => l.stream === s);
2628
+ expect8(mine).toBeDefined();
2629
+ await store.ack(leased);
2630
+ } finally {
2631
+ vi.useRealTimers();
2632
+ }
2633
+ });
2610
2634
  it7("makes a stream claimable once the deferred_at is in the past", async () => {
2611
2635
  const s = `defer-past-${uid()}`;
2612
2636
  await store.subscribe([{ stream: s }]);