WIP: Add TokenManager unit tests #72
Closed
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
Status: Work in Progress - PR #3 of 14 in the test coverage improvement plan
Depends on: #70 (test infrastructure)
Add comprehensive unit tests for TokenManager service covering token creation, verification, and edge cases.
Changes
TokenManager Tests (6 new tests, 9 total)
Existing tests (3):
New tests (6):
test_token_contains_required_subject- Validates subject claim is correcttest_token_has_expiration- Validates expiration timestamp is settest_token_manager_is_clonable- Validates Arc-based sharing works across clonestest_multiple_tokens_from_same_manager- Validates multiple token creationtest_verify_malformed_token- Tests rejection of various malformed formatstest_token_format- Validates JWT structure (header.payload.signature)Coverage
Tests validate all TokenManager functionality:
Test Results
✅ All 34 unique tests pass (27 original + 6 new + 1 doc)
Test Plan
Note
This PR focuses on TokenManager unit tests only. Integration tests for the
/api/tokenendpoint will be added in a future PR if needed, as the token functionality is already tested through middleware integration tests.Related
Signed-off-by: Jan Zachmann [email protected]