test: Cover the error guards and token predicates - #1017
Merged
Conversation
All six exported error guard functions and the token predicates had no test coverage. Add direct tests for each guard and predicate, including subclass and negative cases. Also correct the README claim that client options are deep merged, they are shallow merged, and stop excluding index files from the coverage report, which hid the per-route re-export surface. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B8xeJm2Hd923k8uo6eoFd2
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.
Problem
SDK audit test-suite findings: all six exported error guard functions (
isSeamHttpApiError,isSeamHttpUnauthorizedError,isSeamHttpInvalidInputError,isSeamActionAttemptError,isSeamActionAttemptFailedError,isSeamActionAttemptTimeoutError) and all token predicates (isApiKey,isClientSessionToken,isPublishableKey,isConsoleSessionToken,isPersonalAccessToken, plus internalisAccessToken/isJwt/isSeamToken) had zero test coverage. The README claimed client options are "deep merged" when the merge is a shallow spread (client.ts), and the c8 config excluded**/index.ts, hiding the per-route re-export surface from coverage.Changes
test/seam/connect/error-guards.test.ts: every guard tested against its own instance, subclass relationships (e.g.isSeamHttpApiErrormatchesSeamHttpUnauthorizedError), sibling negatives, and non-error values.test/seam/connect/token.test.ts: every predicate tested against all token kinds, including the exclusion chain inisApiKey..c8rc.json: stop excluding**/index.ts(no thresholds configured, so this only makes the report honest).Full suite (139 tests), lint, typecheck green.
Part of applying the rev-3 SDK audit (one PR per finding). Related: #1002–#1016.
🤖 Generated with Claude Code
https://claude.ai/code/session_01B8xeJm2Hd923k8uo6eoFd2
Generated by Claude Code