@rotorsoft/act-tck 1.27.5 → 1.27.7

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
@@ -2147,6 +2147,27 @@ var runStoreTck = (options) => {
2147
2147
  ]);
2148
2148
  expect8(blocked).toHaveLength(0);
2149
2149
  });
2150
+ it7("re-blocking an already-blocked stream is a no-op (#1263)", async () => {
2151
+ const s = `block-twice-${uid()}`;
2152
+ await store.subscribe([{ stream: s }]);
2153
+ await store.commit(
2154
+ s,
2155
+ [inc(1)],
2156
+ make_meta({ stream: s })
2157
+ );
2158
+ const leased = await store.claim(100, 0, `w-${uid()}`, 1e5);
2159
+ const mine = leased.find((l) => l.stream === s);
2160
+ expect8(mine).toBeDefined();
2161
+ await store.ack(leased.filter((l) => l.stream !== s));
2162
+ const first = await store.block([
2163
+ { ...mine, error: "boom" }
2164
+ ]);
2165
+ expect8(first).toHaveLength(1);
2166
+ const second = await store.block([
2167
+ { ...mine, error: "boom" }
2168
+ ]);
2169
+ expect8(second).toHaveLength(0);
2170
+ });
2150
2171
  });
2151
2172
  describe8("defer", () => {
2152
2173
  it7("hides a stream from claim until its deferred_at passes", async () => {
@@ -3964,6 +3985,48 @@ var runStoreTck = (options) => {
3964
3985
  );
3965
3986
  expect8(bwd).toEqual([10]);
3966
3987
  });
3988
+ it7("time-travel query ignores a snapshot newer than the created cutoff", async () => {
3989
+ const s = `restore-tt-snap-${uid()}`;
3990
+ const t0 = /* @__PURE__ */ new Date("2020-01-01T00:00:00.000Z");
3991
+ const t1 = /* @__PURE__ */ new Date("2020-02-01T00:00:00.000Z");
3992
+ const tSnap = /* @__PURE__ */ new Date("2020-03-01T00:00:00.000Z");
3993
+ await restore(
3994
+ as_source([
3995
+ event(1, s, 0, "Incremented", t0, { amount: 1 }),
3996
+ event(2, s, 1, "Incremented", t1, { amount: 2 }),
3997
+ // Snapshot committed last → highest id and latest `created`.
3998
+ event(3, s, 2, SNAP_EVENT2, tSnap, { count: 3 })
3999
+ ])
4000
+ );
4001
+ const cutoff = /* @__PURE__ */ new Date("2020-01-15T00:00:00.000Z");
4002
+ const before = [];
4003
+ await store.query(
4004
+ (e) => {
4005
+ before.push(e.data.amount);
4006
+ },
4007
+ {
4008
+ stream: s,
4009
+ stream_exact: true,
4010
+ with_snaps: true,
4011
+ created_before: cutoff
4012
+ }
4013
+ );
4014
+ expect8(before).toEqual([1]);
4015
+ const after = [];
4016
+ await store.query(
4017
+ (e) => {
4018
+ if (e.name !== SNAP_EVENT2)
4019
+ after.push(e.data.amount);
4020
+ },
4021
+ {
4022
+ stream: s,
4023
+ stream_exact: true,
4024
+ with_snaps: true,
4025
+ created_after: cutoff
4026
+ }
4027
+ );
4028
+ expect8(after).toEqual([2]);
4029
+ });
3967
4030
  it7.skipIf(!caps.pii_isolation)(
3968
4031
  "isolates restored pii so forget_pii erases it",
3969
4032
  async () => {