Difficulty: Intermediate
Type: test
Background
The README documents a strict QR access-check payload schema (type, version, guildId, resourceId required; walletAddress, expiresAt optional) and states that unsupported types/versions, malformed JSON, missing required fields, invalid wallet addresses, and expired payloads are all rejected before submission — this logic lives in src/features/access/.
Problem
It's not clear this validation matrix has full unit test coverage; without it, a future refactor of the QR parsing/validation code could silently regress one of the documented rejection cases (e.g., accepting an expired payload).
Expected outcome
The QR payload validator has a unit test for every documented rejection case (bad type, unsupported version, malformed JSON, missing guildId/resourceId, invalid walletAddress, expired expiresAt) plus the happy path (valid payload with and without optional fields).
Suggested implementation
- Locate the QR payload validation function in
src/features/access/ and add a dedicated test file under tests/ if one doesn't fully cover this matrix.
- Write one test case per documented rejection reason, asserting a specific, distinguishable error/result (not just a generic
false).
- Add a test confirming a valid payload without the optional
walletAddress/expiresAt fields still passes.
- Run
pnpm test:run to confirm all pass.
Acceptance criteria
Likely affected files/directories
src/features/access/
tests/
Difficulty: Intermediate
Type: test
Background
The README documents a strict QR access-check payload schema (
type,version,guildId,resourceIdrequired;walletAddress,expiresAtoptional) and states that unsupported types/versions, malformed JSON, missing required fields, invalid wallet addresses, and expired payloads are all rejected before submission — this logic lives insrc/features/access/.Problem
It's not clear this validation matrix has full unit test coverage; without it, a future refactor of the QR parsing/validation code could silently regress one of the documented rejection cases (e.g., accepting an expired payload).
Expected outcome
The QR payload validator has a unit test for every documented rejection case (bad
type, unsupportedversion, malformed JSON, missingguildId/resourceId, invalidwalletAddress, expiredexpiresAt) plus the happy path (valid payload with and without optional fields).Suggested implementation
src/features/access/and add a dedicated test file undertests/if one doesn't fully cover this matrix.false).walletAddress/expiresAtfields still passes.pnpm test:runto confirm all pass.Acceptance criteria
pnpm test:runandpnpm typecheckpassLikely affected files/directories
src/features/access/tests/