Skip to content

test(vc): add tests for the isVerifiable proof guard - #140

Open
devorun wants to merge 1 commit into
agentcommercekit:mainfrom
devorun:test/vc-is-verifiable
Open

test(vc): add tests for the isVerifiable proof guard#140
devorun wants to merge 1 commit into
agentcommercekit:mainfrom
devorun:test/vc-is-verifiable

Conversation

@devorun

@devorun devorun commented Aug 10, 2026

Copy link
Copy Markdown

Summary

isVerifiable (packages/vc/src/verification/is-verifiable.ts) was the only helper on the verification path in @agentcommercekit/vc without a co-located test. It guards both verify-parsed-credential and is-revoked, so pinning down its proof shape contract is worthwhile.

This adds a unit test suite that covers each branch of the shape check:

  • returns true for a proof object carrying a type (with and without extra fields)
  • returns false when the proof is missing, null, undefined, or not an object
  • returns false when the proof is an empty object or has no type

Tests only — no source changes.

Testing

  • pnpm --filter @agentcommercekit/vc test — the vc suite passes, including the 8 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 verifiability checks.
    • Verified handling of valid typed proofs and invalid, missing, empty, or improperly formatted proofs.

Cover the proof shape checks: presence, null and undefined proofs,
non-object proofs, and proofs missing a type.
@coderabbitai

coderabbitai Bot commented Aug 10, 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: e9efac4b-e7b4-4665-8e14-5ae3d55e9223

📥 Commits

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

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

Walkthrough

Added tests for isVerifiable using a minimal W3C credential fixture. The tests cover valid typed proofs and invalid or absent proof values.

Changes

Verification tests

Layer / File(s) Summary
Proof validation tests
packages/vc/src/verification/is-verifiable.test.ts
Tests verify true for typed proofs with and without additional fields. Tests verify false for missing, null, undefined, non-object, empty, and untyped proofs.

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 addition of tests for the isVerifiable proof guard.
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