Skip to content

Add unit tests for deep-link parameter validation #235

Description

@Lakes41

Difficulty: Intermediate
Type: test

Background
The README documents strict parameter validation for deep links: guild-detail links require a valid guildId, access-check links require both guildId and resourceId, walletAddress is optional, and invalid/malformed links should redirect to a user-friendly error screen.

Problem
There's no indication this deep-link parameter validation logic has dedicated unit tests, which is risky since Expo Router's file-based routing combined with custom-scheme and universal-link parsing has several edge cases (missing params, extra params, malformed URLs) that are easy to regress.

Expected outcome
The deep-link parsing/validation logic has unit tests for: valid guild-detail link, guild-detail link missing guildId, valid access-check link (with and without optional walletAddress), access-check link missing resourceId, and a fully malformed URL — each asserting the correct outcome (successful navigation params vs. redirect to the error screen).

Suggested implementation

  • Locate the deep-link parsing logic (likely in app/ layout files or a dedicated src/ module) and add a test file under tests/ covering the matrix above.
  • Use fixture URLs for both the custom scheme (guildpass://...) and universal link (https://guildpass.xyz/...) forms to ensure both are parsed identically.
  • Assert that invalid cases route to the documented user-friendly error screen rather than crashing or silently no-op-ing.

Acceptance criteria

  • Tests cover both link formats (custom scheme and universal link) for both link types
  • Missing required params correctly trigger the error screen
  • Optional walletAddress absence doesn't break access-check link handling
  • pnpm test:run passes

Likely affected files/directories

  • app/ (routing/layout deep-link handling)
  • src/
  • tests/

Metadata

Metadata

Assignees

Labels

GrantFox OSSGrantFox Open Source Sponsorship program tagMaybe RewardedIssue may qualify for a reward upon successful completion per campaign rulesOfficial Campaign | FWC26Official FWC26 campaign issue — eligible for campaign scoring and rewardsintermediateIntermediate difficulty tasks requiring solid experience and some contexttestTest coverage additions, test fixes, or test infrastructure work

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions