Skip to content

test(vc): add tests for the credential verification errors - #141

Open
devorun wants to merge 1 commit into
agentcommercekit:mainfrom
devorun:test/vc-verification-errors
Open

test(vc): add tests for the credential verification errors#141
devorun wants to merge 1 commit into
agentcommercekit:mainfrom
devorun:test/vc-verification-errors

Conversation

@devorun

@devorun devorun commented Aug 11, 2026

Copy link
Copy Markdown

Summary

packages/vc/src/verification/errors.ts defines the public CredentialVerificationError hierarchy but had no direct tests. These errors carry real contracts that the rest of the verification code relies on, so this pins them down:

  • every error extends CredentialVerificationError (which API error handlers catch) and Error
  • each error exposes its documented default message and accepts a custom one
  • RevocationCheckError and UnsupportedCredentialStatusError store their detail for logging but keep it out of message — the detail names a dereferenced URL or a credential-supplied value, and handlers return message to the caller
  • RevocationCheckError propagates its cause

Tests only — no source changes.

Testing

  • pnpm --filter @agentcommercekit/vc test — the vc suite passes, including the new cases
  • oxlint and oxfmt --check are clean for the new file

AI usage disclosure

Per AI_POLICY.md: these tests were written with AI assistance (Claude Code). I reviewed every case and understand the behavior each one verifies.

Summary by CodeRabbit

  • Tests
    • Added comprehensive coverage for credential verification errors.
    • Verified default and custom messages, error names, inheritance, optional details, and cause propagation.

Cover the CredentialVerificationError hierarchy, default and custom
messages, and the detail/cause handling of RevocationCheckError and
UnsupportedCredentialStatusError, including that detail is kept out of
the error message.
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: eb252cc9-363d-427c-990a-2d37f419aa3d

📥 Commits

Reviewing files that changed from the base of the PR and between 0b8fdaa and a47d2f3.

📒 Files selected for processing (1)
  • packages/vc/src/verification/errors.test.ts

Walkthrough

Added comprehensive Vitest coverage for credential verification error classes. The tests cover inheritance, messages, names, optional details, and cause propagation.

Changes

Credential verification error tests

Layer / File(s) Summary
Base error behavior
packages/vc/src/verification/errors.test.ts
Added parameterized coverage for error constructors, inheritance, default and custom messages, error names, and base-class behavior.
Specialized error behavior
packages/vc/src/verification/errors.test.ts
Added coverage for RevocationCheckError and UnsupportedCredentialStatusError details, message isolation, and cause propagation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the added tests for credential verification error classes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant