feat: add comprehensive test suite with 100% coverage and Codecov integration#13
Merged
katieschilling merged 4 commits intomainfrom Jan 5, 2026
Merged
feat: add comprehensive test suite with 100% coverage and Codecov integration#13katieschilling merged 4 commits intomainfrom
katieschilling merged 4 commits intomainfrom
Conversation
…egration - Add 348 tests across all modules with 100% statement coverage - Add CI workflow with test, coverage, and Codecov upload - Add vitest configuration with coverage thresholds (95% statements, 85% branches) - Add shared test helpers: mock-store, mock-idp-client, express-mocks, validation - Add test setup file with log suppression (inspired by AWS MCP patterns) - Add tsconfig.test.json for test file type checking - Update eslint config to handle test files separately - Standardize JWT decoding using jose library across codebase - Add onVerifyError callback for token verification debugging - Add comprehensive JSDoc documentation for token refresh logic - Refactor tests to check behavior instead of implementation details Test infrastructure improvements: - Test constants for eliminating magic strings - Validation helpers for common assertion patterns - Mock factories for Keyv stores and OIDC clients - Express request/response mock builders 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The src/test/** directory contains test helpers that use looser typing for mocking purposes. These files are covered by tsconfig.test.json for eslint, but should be excluded from the main tsc --noEmit check. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
rbarabas
approved these changes
Dec 19, 2025
Xe
approved these changes
Jan 5, 2026
Contributor
Xe
left a comment
There was a problem hiding this comment.
The Griffin would approve of this code. Some things seem questionable (like testing the value of constants, i get it but whyyy), but it's fine enough.
- Remove config.test.ts - constants are already covered by usage in other tests - Simplify index.test.ts to check exports exist rather than testing constant values - Testing that `600 === 600` adds no value; export existence checks catch broken exports 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Xe
reviewed
Jan 5, 2026
src/index.test.ts
Outdated
Comment on lines
+74
to
+82
| expect(DEFAULT_ACCESS_TOKEN_TTL).toBeDefined(); | ||
| expect(DEFAULT_AUTHORIZATION_CODE_TTL).toBeDefined(); | ||
| expect(DEFAULT_ID_TOKEN_TTL).toBeDefined(); | ||
| expect(DEFAULT_REFRESH_TOKEN_TTL).toBeDefined(); | ||
| expect(DEFAULT_INTERACTION_SESSION_TTL_MS).toBeDefined(); | ||
| expect(DEFAULT_USER_SESSION_TTL_MS).toBeDefined(); | ||
| expect(DEFAULT_INTERACTION_TTL).toBeDefined(); | ||
| expect(DEFAULT_GRANT_TTL).toBeDefined(); | ||
| expect(DEFAULT_SESSION_TTL).toBeDefined(); |
Contributor
There was a problem hiding this comment.
My thought here is like: my brother in christ if the things weren't defined then the import statement at the top would fail.
As the reviewer noted: if the exports weren't defined, the import statement would fail. The toBeDefined() checks add nothing. The src/index.ts barrel file is now excluded from coverage since it's just re-exports with no logic. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
🎉 This PR is included in version 2.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Test Infrastructure
vitest.config.tswith coverage thresholds (95% statements, 85% branches, 90% functions, 95% lines)src/test/setup.tsfor global test configuration (log suppression, mock cleanup)tsconfig.test.jsonfor separate test file TypeScript configurationeslint.config.jsto handle test files with relaxed rulesTest Helpers
src/test/helpers/express-mocks.ts- Mock Express request/response objectssrc/test/helpers/mock-idp-client.ts- Mock OIDC client for testingsrc/test/helpers/mock-store.ts- Mock Keyv store for testingsrc/test/helpers/validation.ts- AWS MCP-inspired validation helperssrc/test/constants.ts- Shared test constantsTest Files Added
src/core/adapter.test.ts- KeyvAdapter testssrc/express/middleware.test.ts- Express middleware testssrc/mcp/auth-provider.test.ts- MCP auth provider with supertest integration testssrc/mcp/setup.test.ts- Setup function testssrc/oidc/client.test.ts- OIDC client testssrc/oidc/provider.test.ts- OIDC provider testssrc/oidc/server.test.ts- Server configuration testssrc/oidc/server.integration.test.ts- Server integration testssrc/utils/jwks.test.ts- JWKS generation testssrc/utils/logger.test.ts- Logger utility testssrc/utils/index.test.ts- Index exports testsCI/CD
.github/workflows/codecov.ymlfor coverage reporting on PRsCode Improvements
joselibrary'sdecodeJwtonVerifyErrorcallback toMcpAuthProviderOptionsfor debuggingTest Plan
npm test- All 348 tests passnpm run test:coverage- Coverage thresholds metnpm run lint- No lint errorsnpm run build- Build succeeds🤖 Generated with Claude Code