@rotorsoft/act-tck 1.26.4 → 1.26.6
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/.tsbuildinfo +1 -1
- package/dist/@types/store-tck.d.ts +26 -0
- package/dist/@types/store-tck.d.ts.map +1 -1
- package/dist/index.cjs +123 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +123 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1521,7 +1521,130 @@ var runStoreTck = (options) => {
|
|
|
1521
1521
|
await fresh.dispose();
|
|
1522
1522
|
}
|
|
1523
1523
|
});
|
|
1524
|
+
it7("fetches only the exact source stream's events, never a sibling prefix", async () => {
|
|
1525
|
+
const fresh = await options.factory();
|
|
1526
|
+
try {
|
|
1527
|
+
await fresh.drop();
|
|
1528
|
+
await fresh.seed();
|
|
1529
|
+
const base = `fx-${uid()}`;
|
|
1530
|
+
const sibling = `${base}2`;
|
|
1531
|
+
const target = `agg-${uid()}`;
|
|
1532
|
+
await fresh.subscribe([{ stream: target, source: base }]);
|
|
1533
|
+
const [b1] = await seed_stream(fresh, base, 1);
|
|
1534
|
+
await seed_stream(fresh, sibling, 1);
|
|
1535
|
+
const claimed = await fresh.claim(100, 0, `w-${uid()}`, 3e4);
|
|
1536
|
+
const lease = claimed.find((l) => l.stream === target);
|
|
1537
|
+
expect8(lease).toBeDefined();
|
|
1538
|
+
const events2 = await collect(fresh, {
|
|
1539
|
+
stream: lease.source,
|
|
1540
|
+
stream_exact: true,
|
|
1541
|
+
after: -1
|
|
1542
|
+
});
|
|
1543
|
+
expect8(events2.map((e) => e.stream)).toEqual([base]);
|
|
1544
|
+
expect8(events2.map((e) => e.id)).toEqual([b1.id]);
|
|
1545
|
+
} finally {
|
|
1546
|
+
await fresh.dispose();
|
|
1547
|
+
}
|
|
1548
|
+
});
|
|
1524
1549
|
});
|
|
1550
|
+
describe8.skipIf(!caps.pattern_claim_source)(
|
|
1551
|
+
"claim pattern source matching (capability)",
|
|
1552
|
+
() => {
|
|
1553
|
+
it7("claims a pattern-source target when any matched stream has work (^(A|B)$)", async () => {
|
|
1554
|
+
const fresh = await options.factory();
|
|
1555
|
+
try {
|
|
1556
|
+
await fresh.drop();
|
|
1557
|
+
await fresh.seed();
|
|
1558
|
+
const a = `A-${uid()}`;
|
|
1559
|
+
const b = `B-${uid()}`;
|
|
1560
|
+
const target = `board-${uid()}`;
|
|
1561
|
+
const pattern = `^(${a}|${b})$`;
|
|
1562
|
+
await fresh.subscribe([{ stream: target, source: pattern }]);
|
|
1563
|
+
const [ea] = await seed_stream(fresh, a, 1);
|
|
1564
|
+
const first = await fresh.claim(100, 0, `w-${uid()}`, 3e4);
|
|
1565
|
+
const l1 = first.find((s) => s.stream === target);
|
|
1566
|
+
expect8(l1).toBeDefined();
|
|
1567
|
+
await fresh.ack([{ ...l1, at: ea.id }]);
|
|
1568
|
+
const [eb] = await seed_stream(fresh, b, 1);
|
|
1569
|
+
const second = await fresh.claim(100, 0, `w-${uid()}`, 3e4);
|
|
1570
|
+
expect8(second.find((s) => s.stream === target)).toBeDefined();
|
|
1571
|
+
expect8(eb.stream).toBe(b);
|
|
1572
|
+
} finally {
|
|
1573
|
+
await fresh.dispose();
|
|
1574
|
+
}
|
|
1575
|
+
});
|
|
1576
|
+
it7("does not claim a pattern-source target when no matched stream has work", async () => {
|
|
1577
|
+
const fresh = await options.factory();
|
|
1578
|
+
try {
|
|
1579
|
+
await fresh.drop();
|
|
1580
|
+
await fresh.seed();
|
|
1581
|
+
const a = `A-${uid()}`;
|
|
1582
|
+
const b = `B-${uid()}`;
|
|
1583
|
+
const other = `Z-${uid()}`;
|
|
1584
|
+
const target = `board-${uid()}`;
|
|
1585
|
+
const control = `ctl-${uid()}`;
|
|
1586
|
+
const pattern = `^(${a}|${b})$`;
|
|
1587
|
+
await fresh.subscribe([
|
|
1588
|
+
{ stream: target, source: pattern },
|
|
1589
|
+
{ stream: control, source: other }
|
|
1590
|
+
]);
|
|
1591
|
+
const [ea] = await seed_stream(fresh, a, 1);
|
|
1592
|
+
const first = await fresh.claim(100, 0, `w-${uid()}`, 3e4);
|
|
1593
|
+
const l1 = first.find((s) => s.stream === target);
|
|
1594
|
+
expect8(l1).toBeDefined();
|
|
1595
|
+
const c1 = first.find((s) => s.stream === control);
|
|
1596
|
+
expect8(c1).toBeDefined();
|
|
1597
|
+
await fresh.ack([
|
|
1598
|
+
{ ...l1, at: ea.id },
|
|
1599
|
+
{ ...c1, at: -1 }
|
|
1600
|
+
]);
|
|
1601
|
+
await seed_stream(fresh, other, 1);
|
|
1602
|
+
const claimed = await fresh.claim(100, 0, `w-${uid()}`, 3e4);
|
|
1603
|
+
const streams = claimed.map((s) => s.stream);
|
|
1604
|
+
expect8(streams).toContain(control);
|
|
1605
|
+
expect8(streams).not.toContain(target);
|
|
1606
|
+
} finally {
|
|
1607
|
+
await fresh.dispose();
|
|
1608
|
+
}
|
|
1609
|
+
});
|
|
1610
|
+
}
|
|
1611
|
+
);
|
|
1612
|
+
describe8.skipIf(!caps.rejects_nonportable_claim_source)(
|
|
1613
|
+
"claim source registration (capability)",
|
|
1614
|
+
() => {
|
|
1615
|
+
it7("throws at subscribe for a non-portable (alternation) claim source", async () => {
|
|
1616
|
+
const fresh = await options.factory();
|
|
1617
|
+
try {
|
|
1618
|
+
await fresh.drop();
|
|
1619
|
+
await fresh.seed();
|
|
1620
|
+
await expect8(
|
|
1621
|
+
fresh.subscribe([
|
|
1622
|
+
{ stream: `board-${uid()}`, source: `^(${uid()}|${uid()})$` }
|
|
1623
|
+
])
|
|
1624
|
+
).rejects.toThrow(ValidationError);
|
|
1625
|
+
} finally {
|
|
1626
|
+
await fresh.dispose();
|
|
1627
|
+
}
|
|
1628
|
+
});
|
|
1629
|
+
it7("accepts a portable-subset pattern claim source (^prefix.*) and claims on match", async () => {
|
|
1630
|
+
const fresh = await options.factory();
|
|
1631
|
+
try {
|
|
1632
|
+
await fresh.drop();
|
|
1633
|
+
await fresh.seed();
|
|
1634
|
+
const prefix = `pfx${uid()}`.replace(/-/g, "");
|
|
1635
|
+
const matched = `${prefix}child`;
|
|
1636
|
+
const target = `board-${uid()}`;
|
|
1637
|
+
await fresh.subscribe([{ stream: target, source: `^${prefix}.*` }]);
|
|
1638
|
+
const [e] = await seed_stream(fresh, matched, 1);
|
|
1639
|
+
const claimed = await fresh.claim(100, 0, `w-${uid()}`, 3e4);
|
|
1640
|
+
expect8(claimed.find((s) => s.stream === target)).toBeDefined();
|
|
1641
|
+
expect8(e.stream).toBe(matched);
|
|
1642
|
+
} finally {
|
|
1643
|
+
await fresh.dispose();
|
|
1644
|
+
}
|
|
1645
|
+
});
|
|
1646
|
+
}
|
|
1647
|
+
);
|
|
1525
1648
|
describe8.skipIf(!caps.concurrent_claim)("concurrency (capability)", () => {
|
|
1526
1649
|
it7("never double-leases a stream across concurrent claimers", async () => {
|
|
1527
1650
|
const fresh = await options.factory();
|