Files
OmniRoute/tests
diegosouzapw e043682a23 test(sse): read the errored Kiro failure stream instead of buffering it
"Kiro stream errors become Responses response.failed events" drove the
transform with `new Response(transform.readable).text()`. That cannot
observe the contract it is asserting: createStreamFailureAborter forwards
the translated failure event and then errors the controller on purpose,
so a translated upstream error never ends as a clean, successful-looking
stream (the sibling tests in stream-passthrough-error-redaction and
stream-utils pin exactly that). `.text()` discards the forwarded bytes
and rejects, `await writer.close()` threw ERR_INVALID_STATE first, and
the abandoned `.text()` rejection surfaced as an unhandledRejection
after the test ended.

Drive it the way production does instead — `pipeThrough` plus a reader,
the same shape as collectUntilFailure() in the sibling suite. The
forwarded event is kept (a pending read is fulfilled before the error
resets the queue) and the deliberate termination is now asserted rather
than tripped over. All four original assertions are unchanged; the
termination assertion is added.

Production code is untouched: `pipeThrough` marks its internal pipeTo
promise handled, so the abandoned rejection never existed off the test
bench. 6/6 green.
2026-09-11 18:15:03 -03:00
..