@dudousxd/nestjs-durable-testing 0.23.2 → 0.23.3

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
@@ -1746,6 +1746,71 @@ function runStateStoreContract(name, makeStore) {
1746
1746
  ])).toBe(0);
1747
1747
  expect3(await store.countCheckpoints("r1", 0, 4, [])).toBe(0);
1748
1748
  });
1749
+ t("hasCheckpoints answers whether a seq range holds a status", async () => {
1750
+ expect3(store.hasCheckpoints).toBeDefined();
1751
+ if (!store.hasCheckpoints) return;
1752
+ await store.createRun(run());
1753
+ for (const [seq, status] of [
1754
+ [
1755
+ 0,
1756
+ "completed"
1757
+ ],
1758
+ [
1759
+ 1,
1760
+ "pending"
1761
+ ],
1762
+ [
1763
+ 2,
1764
+ "completed"
1765
+ ],
1766
+ [
1767
+ 3,
1768
+ "failed"
1769
+ ],
1770
+ [
1771
+ 4,
1772
+ "completed"
1773
+ ]
1774
+ ]) {
1775
+ await store.saveCheckpoint(checkpoint({
1776
+ seq,
1777
+ status,
1778
+ stepId: `r1:${seq}`
1779
+ }));
1780
+ }
1781
+ await store.createRun(run({
1782
+ id: "other"
1783
+ }));
1784
+ await store.saveCheckpoint(checkpoint({
1785
+ runId: "other",
1786
+ seq: 4,
1787
+ status: "pending",
1788
+ stepId: "other:4"
1789
+ }));
1790
+ expect3(await store.hasCheckpoints("r1", 0, 4, [
1791
+ "pending"
1792
+ ])).toBe(true);
1793
+ expect3(await store.hasCheckpoints("r1", 1, 1, [
1794
+ "pending"
1795
+ ])).toBe(true);
1796
+ expect3(await store.hasCheckpoints("r1", 2, 4, [
1797
+ "pending"
1798
+ ])).toBe(false);
1799
+ expect3(await store.hasCheckpoints("r1", 2, 4, [
1800
+ "pending",
1801
+ "failed"
1802
+ ])).toBe(true);
1803
+ expect3(await store.hasCheckpoints("r1", 4, 4, [
1804
+ "pending"
1805
+ ])).toBe(false);
1806
+ expect3(await store.hasCheckpoints("other", 0, 9, [
1807
+ "pending"
1808
+ ])).toBe(true);
1809
+ expect3(await store.hasCheckpoints("r1", 5, 9, [
1810
+ "completed"
1811
+ ])).toBe(false);
1812
+ expect3(await store.hasCheckpoints("r1", 0, 4, [])).toBe(false);
1813
+ });
1749
1814
  registerCheckpointAggregationCases(t, () => store, run);
1750
1815
  t("listOrphanedRuns returns incomplete runs with a free or expired lease, oldest first", async () => {
1751
1816
  expect3(store.listOrphanedRuns).toBeDefined();