Skip to content

Add integration tests for the marketplace listing detail and purchase API routesΒ #595

@1nonlypiece

Description

@1nonlypiece

πŸ“Œ Description

The marketplace API has several routes β€” listings/[id]/preflight/route.ts,
listings/[id]/purchase/route.ts, featured/route.ts, and stats/route.ts.
There are tests for listings/route.ts and listings/[id]/route.ts
(route.test.ts) and tests/api/marketplace-purchase.test.ts, but preflight,
featured, and stats lack dedicated coverage.

This issue closes the marketplace API integration-test gaps.

Goal: the preflight, featured, and stats marketplace routes are covered for
success, validation, and error responses.

🎯 Requirements and Context

  • Add integration tests for listings/[id]/preflight (eligible vs ineligible
    buyer, sold-out listing).
  • Add tests for marketplace/featured and marketplace/stats response shapes.
  • Reuse tests/api/helpers.ts request utilities.
  • Assert ETag/caching behavior where these routes use it
    (marketplace-cache-invalidation.test.ts patterns).

πŸ› οΈ Suggested Execution

1. Create a branch

git checkout -b feature/marketplace-api-tests

2. Implement changes

  • Add tests/api/marketplace-preflight.test.ts,
    tests/api/marketplace-featured.test.ts, and
    tests/api/marketplace-stats.test.ts.

3. Test and commit

  • Run npm test.
  • Edge cases: missing listing id, ineligible buyer, empty featured set, stats
    with zero listings.

Example commit message

test: cover marketplace preflight, featured, and stats routes

βœ… Guidelines

  • Minimum 95% test coverage on the targeted routes.
  • Clear, descriptive test names.
  • Timeframe: 96 hours.

🏷️ Labels

type-testing Β· area-frontend Β· MAYBE REWARDED Β· GRANTFOX OSS Β· OFFICIAL CAMPAIGN

πŸ’¬ Community & Support

  • Join the CommitLabs contributor Discord: https://discord.gg/WV7tdYkJk
  • Introduce yourself before starting to avoid duplicate work.
  • Maintainers triage actively and review fast.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions