fix: guard the abort listener against a double invocation
Copilot review round 1. The helper's contract is exactly-once teardown and the test asserted it must not lean on Hono's own re-entry guard, but neither the implementation nor the test actually enforced that: the listener had no local guard and the test aborted only once. Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
parent
3dfac1c3db
commit
e58c80440b
1 changed files with 11 additions and 1 deletions
|
|
@ -138,9 +138,12 @@ describe("primeAndHoldSseStream (#1999)", () => {
|
|||
|
||||
s.finishWrite();
|
||||
s.abort();
|
||||
// Hono guards re-entry itself, but the helper must not depend on that —
|
||||
// so drive the listener a second time directly.
|
||||
s.abort();
|
||||
await withinTick(held);
|
||||
// Hono guards re-entry itself, but the helper must not depend on that.
|
||||
expect(cleanups).toBe(1);
|
||||
expect(s.closes).toBe(1);
|
||||
});
|
||||
|
||||
it("does not reject when cleanup's own close loses the race", async () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue