test: add SessionProvider unit and WASM integration tests#2435
Open
kronosapiens wants to merge 1 commit intomainfrom
Open
test: add SessionProvider unit and WASM integration tests#2435kronosapiens wants to merge 1 commit intomainfrom
kronosapiens wants to merge 1 commit intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Add focused unit tests for SessionProvider's core logic (validatePoliciesSubset, ingestSessionFromRedirect, constructor validation, disconnect selective removal). Add WASM integration tests exercising real binary with toWasmPolicies round-trip, policy ordering stability, and address normalization. Both test suites pass with all existing tests (67 Jest + 15 WASM). Includes test:wasm npm script for standalone Node.js WASM testing. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
56ee483 to
c802c1b
Compare
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
Adds comprehensive test coverage for
SessionProviderclass with two test suites:Unit Tests (
session-provider.test.ts): 16 focused Jest tests covering pure TypeScript logic—constructor validation, policy subset validation, session ingestion from redirects, and selective disconnect cleanup. No WASM or network dependencies.WASM Integration Tests (
wasm-integration.test.mjs): 15 tests exercising the real@cartridge/controller-wasmbinary to verify policy conversion and session account construction end-to-end.Also adds
test:wasmnpm script for standalone Node.js WASM testing.Test Coverage
validatePoliciesSubset()logic: subset matching, address/method rejection, authorization validation, message policiesingestSessionFromRedirect(): base64 decoding, padding correction, malformed payload handling, required field validationdisconnect(): selective localStorage removalAll tests pass. No regressions to existing tests.