Skip to content

test(uws-platform): assert HEAD route registration on static-asset single-call tests#116

Merged
VikramAditya33 merged 1 commit into
FOSSFORGE:mainfrom
mvanhorn:osc/82-static-head-tests
May 11, 2026
Merged

test(uws-platform): assert HEAD route registration on static-asset single-call tests#116
VikramAditya33 merged 1 commit into
FOSSFORGE:mainfrom
mvanhorn:osc/82-static-head-tests

Conversation

@mvanhorn
Copy link
Copy Markdown
Contributor

@mvanhorn mvanhorn commented May 11, 2026

Summary

The useStaticAssets() implementation registers both GET and HEAD routes per call (uws-platform.adapter.ts:822-823), but six of the seven success-path tests in the static assets describe block only asserted the GET registration. The one multi-call test already verifies the GET+HEAD = 4 shape; the single-call tests were the gap the issue calls out.

Closes #82

Why this matters

If a refactor accidentally drops the this.head(routePattern, ...) line, today's tests would still pass because none of the single-call cases check for the HEAD registration. That's the bug class issue #82 surfaces. Strengthening the assertions to match the multi-call test's pattern closes the loop and keeps the suite a true regression net for static-asset routing.

Change

src/http/platform/uws-platform.adapter.spec.ts only. Six single-call success-path tests now assert toHaveBeenCalledTimes(2) plus the corresponding HEAD registration alongside the existing GET assertion: should enable static assets and register catch-all route, should respect silent option and not log, should register static assets route when custom options provided, should support prefix option for scoped static routes, should normalize prefix by removing trailing slash, should handle empty prefix by using default catch-all.

Untouched: the multi-call should register multiple static asset routes when called multiple times (already correct - asserts 4 registrations) and the two error-path tests for invalid input (no registrations to assert).

Verification

npm test -- --testPathPatterns=uws-platform -> Test Suites: 1 passed, 1 total / Tests: 66 passed, 66 total. No production code touched.

Risk

None - tests-only strengthening.

Summary by CodeRabbit

  • Tests
    • Updated static assets test suite to verify both GET and HEAD route registration for static asset endpoints, ensuring proper HTTP method support.

Review Change Stack

…tic-asset tests

The static-asset implementation registers both GET and HEAD routes
(uws-platform.adapter.ts:822-823), but the six single-call tests in
the 'static assets' describe block only asserted the GET registration
- so a refactor that accidentally dropped the HEAD line would have
passed the test suite.

Each of the six tests now asserts toHaveBeenCalledTimes(2) plus the
corresponding HEAD registration alongside the GET one. The multi-call
test that already verified the 4-registration shape and the
error-path tests (no registrations to assert) are unchanged.

All 66 tests in the file still pass.

Closes FOSSFORGE#82
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9f683d89-c271-4a1e-b332-41990ddc4207

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@VikramAditya33 VikramAditya33 self-requested a review May 11, 2026 08:58
Copy link
Copy Markdown
Collaborator

@VikramAditya33 VikramAditya33 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thank you

@VikramAditya33 VikramAditya33 merged commit ae9aa77 into FOSSFORGE:main May 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Static assets tests don't verify HEAD route registration

2 participants