Skip to content

Add Fastify route integration tests #10

@Lakes41

Description

@Lakes41

Summary

Add integration tests for the access API routes so endpoint behaviour is verified through Fastify rather than only through service-level assumptions.

Current Behaviour

The access API package uses jest --passWithNoTests, so the package can pass CI without route coverage. Core endpoints such as membership lookup, profile lookup, access checks, and member listing are not protected by request-level tests.

Expected Behaviour

Each public API route should have tests that verify request handling, response status codes, payload shapes, and service integration.

Suggested Implementation

Refactor the API bootstrap so tests can create a Fastify instance without binding to a network port. Use app.inject() with either a test database, a mocked Prisma client, or a mocked member service.

Files or Areas Likely Affected

  • apps/access-api/src/index.ts
  • apps/access-api/src/routes.ts
  • apps/access-api/src/services/memberService.ts
  • apps/access-api/src/**/*.test.ts
  • apps/access-api/package.json

Acceptance Criteria

  • Tests cover GET /health
  • Tests cover GET /v1/memberships/:wallet
  • Tests cover GET /v1/members/:wallet for found and not-found cases
  • Tests cover POST /v1/access/check for allow and deny decisions
  • Tests cover GET /v1/communities/:communityId/members
  • Tests run through npm run -w access-api test

Additional Notes

Keep the tests deterministic. Do not require a live external API or deployed contract.

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