Test: Add req and res streaming e2e tests#106
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/http/streaming-connection-abort.e2e.spec.ts`:
- Around line 148-152: The test currently calls req.destroy() then immediately
resolves the promise (using requestDestroyed = true; resolve()), which can let
the test pass without observing the actual transport abort event; change the
logic in the timeout handler to call req.destroy() and then wait for the
socket/request to emit a terminal event (listen for 'error' or 'close' on
req/req.socket) and only set requestDestroyed = true and resolve the promise
when one of those events fires (with a short safety timeout to fail if no event
arrives). Apply the same change to the other instance around lines 167-169 so
both cases wait for the real abort signal rather than resolving immediately.
In `@test/http/streaming-large-payloads.e2e.spec.ts`:
- Around line 30-32: The current Promise awaiting passthrough end only listens
for 'end' and can hang if either stream errors; change the Promise in the test
to accept (resolve, reject) and attach 'error' handlers on both passthrough and
req (e.g., passthrough.on('error', reject) and req.on('error', reject)) so the
promise rejects immediately on stream errors; also remove/cleanup listeners
after resolve/reject to avoid leaks and ensure the test fails fast.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4d5cc829-dc87-49ac-9132-123d0dbf4b87
📒 Files selected for processing (15)
eslint.config.mjstest/http/response-events.e2e.spec.tstest/http/response-multiple-writes.e2e.spec.tstest/http/response-stream-chunked.e2e.spec.tstest/http/response-stream-content-length.e2e.spec.tstest/http/response-stream-nodejs-piping.e2e.spec.tstest/http/response-stream-pipefrom.e2e.spec.tstest/http/streaming-backpressure.e2e.spec.tstest/http/streaming-chunked-transfer.e2e.spec.tstest/http/streaming-connection-abort.e2e.spec.tstest/http/streaming-data-integrity.e2e.spec.tstest/http/streaming-large-payloads.e2e.spec.tstest/http/streaming-non-post-methods.e2e.spec.tstest/http/streaming-pipe-buffer.e2e.spec.tstest/http/streaming-pipe-passthrough.e2e.spec.ts
b8fbeb3 to
15670c3
Compare
Tests added:
Fixed eslint config for unused var
Closes #99
Summary by CodeRabbit
Tests
Chores