Skip to content

Add automated component and integration tests #11

@Lakes41

Description

@Lakes41

Summary

Introduce a real frontend test suite for the most important member, admin, wallet, and gated access flows.

Current Behaviour

The project has lint and typecheck scripts, but no visible test script or test framework. Behaviour such as mock/live API switching, admin guards, access denial, and role assignment is not protected by automated tests.

Expected Behaviour

Core UI and API integration behaviour should be covered by deterministic tests that run in CI and local development.

Suggested Implementation

Add Vitest with React Testing Library for component and hook-level tests. Add mock providers for wagmi and React Query. Cover mock API behaviour, Gated, AdminGuard, admin member role assignment, and policy updates.

Files or Areas Likely Affected

  • package.json
  • vitest.config.ts
  • test/
  • components/gated.tsx
  • components/admin-guard.tsx
  • app/admin/members/page.tsx
  • app/admin/policies/page.tsx
  • lib/api/

Acceptance Criteria

  • npm test runs the frontend test suite
  • Tests cover connected and disconnected wallet states
  • Tests cover allowed and denied gated access
  • Tests cover admin and non-admin access to admin pages
  • Tests cover role assignment success and validation failure
  • Tests are documented in the README or contributing guide

Additional Notes

Keep tests independent from browser wallet extensions and external blockchain RPC endpoints.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaign

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions