Skip to content

test: add more unit tests#152

Open
guitaoliu wants to merge 1 commit intoEntrustCorporation:mainfrom
guitaoliu:add-unit-tests
Open

test: add more unit tests#152
guitaoliu wants to merge 1 commit intoEntrustCorporation:mainfrom
guitaoliu:add-unit-tests

Conversation

@guitaoliu
Copy link
Copy Markdown
Collaborator

@guitaoliu guitaoliu commented Dec 29, 2025

codex did the work.

Copilot AI review requested due to automatic review settings December 29, 2025 14:52
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds comprehensive unit test coverage across the codebase, focusing on storage management, authentication flows, API clients, and utility functions. The tests improve code reliability by validating core functionality including token handling, OIDC flows, passkey authentication, and various authentication methods.

  • Adds test coverage for storage implementations (MemoryStore, LocalStorageStore) and StorageManager
  • Implements extensive tests for authentication transactions, RBA client, and auth client methods
  • Expands API function tests and adds coverage for crypto utilities and browser helpers

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/unit/storage/StorageManager.test.ts Updated test description and added tests for token removal errors, expired token cleanup, and IDaaS session token storage
test/unit/storage/MemoryStore.test.ts New test file covering basic CRUD operations for in-memory storage
test/unit/storage/LocalStorageStore.test.ts New test file validating localStorage-backed storage implementation
test/unit/passkey.test.ts Added tests for buildPubKeyRequestOptions and updated buildFidoResponse tests
test/unit/jwt.test.ts Enhanced JWT validation tests including missing alg claim and improved expired token test
test/unit/helpers.ts Updated mockFetch to return proper Response objects instead of partial mocks
test/unit/crypto.test.ts New test file for crypto utility functions including random string generation and challenge pairs
test/unit/browser.test.ts Expanded browser utility tests including popup management and authorization listener
test/unit/api.test.ts Significantly expanded API tests covering all major endpoints and error handling
test/unit/RbaClient.test.ts New comprehensive test file for RBA client authentication flows
test/unit/OidcClient.popup.test.ts New test file validating popup-based OIDC login flow
test/unit/IdaasContext.test.ts New test file covering context initialization and OIDC config caching
test/unit/IdaasClient/login.test.ts Updated login tests with better fetch mocking and validation
test/unit/IdaasClient/handleRedirect.test.ts Enhanced redirect handling tests with better error coverage
test/unit/IdaasClient/getters.test.ts New test file validating client getter methods
test/unit/IdaasClient/getUserInfo.test.ts Added test for JWT userinfo response handling
test/unit/IdaasClient/getIdTokenClaims.test.ts Added test for missing decoded claims scenario
test/unit/IdaasClient/getAccessToken.test.ts Enhanced access token tests with better coverage of edge cases
test/unit/AuthenticationTransaction.test.ts New extensive test file covering all authentication transaction scenarios
test/unit/AuthClient.test.ts New comprehensive test file for all auth client methods including passkey and biometric
src/utils/passkey.ts Refactored to extract response into a variable for better readability
src/storage/MemoryStore.ts Added explicit constructor for test coverage tracking
src/storage/LocalStorageStore.ts Added explicit constructor for test coverage tracking
src/api.ts Added URL normalization to trim whitespace and trailing slashes
src/IdaasClient.ts Removed private storageManager getter previously used for testing
bunfig.toml Added coverage thresholds and expanded ignore patterns

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/unit/IdaasClient/login.test.ts Outdated
Comment thread test/unit/helpers.ts
Comment thread src/storage/MemoryStore.ts
@guitaoliu guitaoliu force-pushed the add-unit-tests branch 4 times, most recently from c3d5089 to feb9a4d Compare January 8, 2026 01:28
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.

2 participants