📌 Description
src/hooks/useNftMetadata.ts fetches NFT metadata and exposes loading/error state, but it has no test. The success, failure, and abort-on-unmount branches are unverified.
🎯 Requirements and Context
- Mock fetch to cover the success, HTTP-error, and network-error branches.
- Assert loading transitions to loaded/errored correctly.
- Assert in-flight requests are aborted on unmount or token change.
🛠️ Suggested Execution
1. Fork the repo and create a branch
git checkout -b test/use-nft-metadata-tests
2. Implement changes
src/hooks/__tests__/useNftMetadata.test.ts — new unit test with mocked fetch
src/hooks/useNftMetadata.ts — read only
3. Test and commit
- Run the suite:
pnpm test (or npm test) and pnpm lint.
- Cover edge cases: 404 response; malformed JSON; abort on unmount; token changes mid-fetch.
- Include test output (and a short note of any behavioural findings) in the PR.
Example commit message
test: add unit coverage for useNftMetadata fetch and error paths
✅ Guidelines
- Minimum 95% test coverage on the new/changed lines.
- Clear, reviewer-friendly documentation and a small, focused diff.
- No regressions against existing suites.
- Timeframe: 96 hours.
🏷️ Labels
type-testing · area-frontend · MAYBE REWARDED · GRANTFOX OSS · OFFICIAL CAMPAIGN
💬 Community & Support
- Join the CommitLabs contributor Discord to coordinate, ask questions, and get
unblocked fast: https://discord.gg/WV7tdYkJk
- Please introduce yourself in the channel before you start so we can avoid
duplicate work, pair you with a reviewer, and get your PR merged quickly.
- Maintainers actively triage this channel and aim for fast, clear, respectful
reviews — reach out any time you're blocked.
📌 Description
src/hooks/useNftMetadata.tsfetches NFT metadata and exposes loading/error state, but it has no test. The success, failure, and abort-on-unmount branches are unverified.🎯 Requirements and Context
🛠️ Suggested Execution
1. Fork the repo and create a branch
2. Implement changes
src/hooks/__tests__/useNftMetadata.test.ts— new unit test with mocked fetchsrc/hooks/useNftMetadata.ts— read only3. Test and commit
pnpm test(ornpm test) andpnpm lint.Example commit message
✅ Guidelines
🏷️ Labels
type-testing·area-frontend·MAYBE REWARDED·GRANTFOX OSS·OFFICIAL CAMPAIGN💬 Community & Support
unblocked fast: https://discord.gg/WV7tdYkJk
duplicate work, pair you with a reviewer, and get your PR merged quickly.
reviews — reach out any time you're blocked.