Feat: add static-file serving e2e tests#115
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 |
4da623f to
c58e5d7
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
test/http/static-file-serving.e2e.spec.ts (1)
1-1: 💤 Low valueConsider using more targeted TypeScript suppressions.
The
@ts-nocheckdirective disables all TypeScript checking for this file, which can hide genuine type errors. If only specific NestJS decorator patterns cause issues, consider using@ts-expect-erroron those specific lines with explanatory comments, or investigate configuring TypeScript/Jest to handle decorators properly.🤖 Prompt for 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. In `@test/http/static-file-serving.e2e.spec.ts` at line 1, Replace the blanket top-file "@ts-nocheck" with targeted suppressions: remove the directive at the top of the test file and instead add "@ts-expect-error" directly above the specific NestJS decorator usages (with a short comment explaining why the suppression is needed), or alternatively update the Jest/tsconfig settings to support decorators so no suppressions are necessary; search for decorator lines in this test file to apply the targeted "@ts-expect-error" annotations and explanatory comments near those symbols.
🤖 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/static-file-serving.e2e.spec.ts`:
- Around line 372-373: Move the fixture creation for the file named "space
test.txt" out of the test "should handle URL-encoded spaces in path" and into
the existing beforeAll hook where other test files are created: locate the
fs.writeFileSync(...) call in that test and add an equivalent write in the
beforeAll setup (alongside other fs.writeFileSync calls), then remove the
file-creation line from the test so the test only asserts behavior and relies on
the shared fixture created during beforeAll.
- Around line 271-277: The test "should return 200 for matching If-Match with
strong ETag" is using If-Match: * which always succeeds and doesn't validate
weak vs strong ETag semantics; update the test in
static-file-serving.e2e.spec.ts to either (A) verify the server generates weak
ETags by first calling httpGet('/test.txt') and asserting the returned ETag
header starts with 'W/' (to prove default weak ETags), or (B) test If-Match
conditional behavior by fetching the actual ETag (via httpGet('/test.txt')),
then calling httpGet('/test.txt', { 'If-Match': <that-etag-without-W/> }) to
assert failure for weak vs strong comparison or calling httpGet with the exact
returned ETag to assert success; use the existing test name and httpGet helper
to locate and modify the test.
---
Nitpick comments:
In `@test/http/static-file-serving.e2e.spec.ts`:
- Line 1: Replace the blanket top-file "@ts-nocheck" with targeted suppressions:
remove the directive at the top of the test file and instead add
"@ts-expect-error" directly above the specific NestJS decorator usages (with a
short comment explaining why the suppression is needed), or alternatively update
the Jest/tsconfig settings to support decorators so no suppressions are
necessary; search for decorator lines in this test file to apply the targeted
"@ts-expect-error" annotations and explanatory comments near those symbols.
🪄 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: b85aea96-efc7-40b1-84f1-9b5c3f497828
📒 Files selected for processing (1)
test/http/static-file-serving.e2e.spec.ts
c58e5d7 to
0152c7f
Compare
Closes #114
Tests added:
Summary by CodeRabbit