Skip to content

Add campaign API route tests for auth, validation, and rate limits #67

Description

@pragmaticAweds

Context

Campaign creation has service and validation tests, but the API route combines JWT auth, route-level rate limiting, controller validation, Cairo client selection, and response mapping. These integration points are not covered by route/controller tests.

Scope

  • Add route/controller tests for POST /api/v1/campaigns
  • Cover missing/invalid auth token responses
  • Cover validation failures for campaign_ref, target_amount, title, and donation_token
  • Cover duplicate campaign refs and wallet/balance errors through mocked service dependencies or repositories
  • Cover the rate-limit response shape and headers where practical
  • Ensure the success response includes campaign ID, ref, target, token, transaction hash, and created timestamp

Out of Scope

  • Live Cairo/StarkNet calls
  • Campaign listing or update endpoints
  • Changing campaign creation business rules

Acceptance Criteria

  • Campaign API behavior is covered at route/controller level
  • Expected client errors return stable status codes and error codes
  • Rate-limit behavior is tested without slowing the suite
  • bun run type-check passes
  • bun run test passes
  • bun run lint passes

Suggested Files or Packages

  • src/components/v1/campaign/
  • src/components/v1/routes.api.v1.ts
  • src/__tests__/
  • src/appMiddlewares/jwtAuth.api.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave program

    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