Skip to content

test: Add unit tests for middleware#90

Open
Vishmayraj wants to merge 2 commits into
OneBusAway:mainfrom
Vishmayraj:test/middleware
Open

test: Add unit tests for middleware#90
Vishmayraj wants to merge 2 commits into
OneBusAway:mainfrom
Vishmayraj:test/middleware

Conversation

@Vishmayraj

Copy link
Copy Markdown

internal/middleware had no test coverage. This PR adds tests for:

SecurityHeaders: verifies all 7 security headers are set with correct
values, and that the next handler is called correctly.

CachedPromHandler: verifies empty cache fallback, correct Content-Type
when cache is populated, and concurrent read safety (verified with -race).

SentryMiddleware is intentionally skipped — it wraps a third-party SDK
with no testable surface without mocking Sentry internals.

All existing tests continue to pass.

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.

1 participant