Skip to content

Test/api client display helpers pr template - #330

Open
favourawaku wants to merge 3 commits into
RWA-ToolKit:mainfrom
favourawaku:test/api-client-display-helpers-pr-template
Open

Test/api client display helpers pr template#330
favourawaku wants to merge 3 commits into
RWA-ToolKit:mainfrom
favourawaku:test/api-client-display-helpers-pr-template

Conversation

@favourawaku

Copy link
Copy Markdown

Summary

Adds test coverage for lib/api.ts error handling and lib/display.ts truncation logic, with investigations into actual current behavior and code status. Also adds .github/PULL_REQUEST_TEMPLATE.md
with a concrete testing/accessibility checklist reflecting this repo's established practices.

Changes

#258 — test: add coverage for api client non-200 and malformed-body handling

  • Non-200 responses: Correctly handled — returns null
  • Malformed response body (e.g., 200 with invalid JSON): Currently throws unhandled SyntaxError
    • fetchJson() lacks try-catch around res.json() call
    • If response status is 2xx but body is not valid JSON (or is HTML from an error page), the parsing error propagates as unhandled
    • This is a genuine bug — an unhandled rejection from the core API client can crash a calling component or leave UI in inconsistent loading state
    • Tests document this current buggy behavior (they pass against reality); flagged here as critical to fix in follow-up work

#257 — test: add coverage for display helpers truncation consistency and edge inputs

  • Confirmed: lib/display.ts functions (sanitizeDisplayText, getDisplayText) are actively used (not dead code) in AssetCard, AssetHeader, AssetDetailView components
  • Functions are general-purpose text sanitization/truncation, not address-specific (despite issue framing)
  • Tests cover: HTML/control-char removal, truncation by length and line count, empty/short input handling, combined scenarios
  • All tests pass against current implementation

#241 — docs: add PR template with testing and accessibility checklist

  • New .github/PULL_REQUEST_TEMPLATE.md with concrete, verifiable checklist items
  • Checklist maps to this repo's actual CI practices and established conventions:
    • Pure-function tests follow lib/__tests__/format.test.ts pattern
    • Component tests use @testing-library/react with screen.getByRole() for accessibility-first assertions
    • CI runs: typecheck, test, lint, build (per .github/workflows/web.yml)
  • Template is useful, not performative — each item is verifiable, not vague

Notes

  • test: add coverage for api client #258 bug flagged for maintainer attention: The unhandled JSON parsing error in the core API client is a real reliability issue worth fixing in follow-up work (not in scope for this test-coverage
    batch)
  • Committer: Favour Sabo (favourawaku)
  • Test-only delivery: no install/build/test/scripts run during implementation

Closes #258, Closes #257, Closes #241

@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@favourawaku Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

test: add coverage for api client test: add coverage for display helpers docs: add a PR template with a testing and accessibility checklist

1 participant