Skip to content

test(spend-permission): add coverage for fetchPermission#360

Open
anilkaracay wants to merge 1 commit into
base:masterfrom
anilkaracay:test/fetch-permission-coverage
Open

test(spend-permission): add coverage for fetchPermission#360
anilkaracay wants to merge 1 commit into
base:masterfrom
anilkaracay:test/fetch-permission-coverage

Conversation

@anilkaracay

Copy link
Copy Markdown

Problem

fetchPermission.ts (spend-permission utility) had no co-located test coverage,
unlike its sibling fetchPermissions.ts (plural), which has full tests.

Change

Adds fetchPermission.test.ts with characterization tests for the existing behavior.
No production code is changed. Tests mirror the conventions of the existing
fetchPermissions.node.test.ts (same mocking of :util/provider.js, provider stub,
assertion style) and import the wrapped export.

Coverage:

  • with provider: correct coinbase_fetchPermission request and unwrapped .permission result; error propagation
  • without provider: request via fetchRPCRequest to CB_WALLET_RPC_URL; error propagation
  • return shape: unwraps .permission; handles a minimal permission
  • current behavior on malformed RPC responses (characterization, explicitly labelled as
    documenting today's behavior, not asserting it is correct): null response rejects;
    response without a permission key resolves undefined

Testing

  • Added 10 tests in .../spend-permission/methods/fetchPermission.test.ts
  • yarn test --run: full suite green (account package 74 files / 1010 tests)
  • yarn format: clean (Biome)
  • yarn build:packages: type-checks

Notes

Tests only. The malformed-response cases are characterization tests documenting current
behavior for future reference; they do not change any behavior.

@cb-heimdall

Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@anilkaracay anilkaracay marked this pull request as ready for review July 10, 2026 04:32
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