Skip to content

Write full e2e test suite covering the complete gist lifecycle #608

@BigBen-7

Description

@BigBen-7

Description

The project needs a comprehensive end-to-end test suite that proves the full gist lifecycle works: create a gist, verify it is in the database, query it by location, fetch its IPFS content, verify expiry. This is the most visible quality signal for campaign reviewers and judges.

Context

  • e2e tests live in Backend/test/
  • The project uses Jest and Supertest for e2e testing
  • A real PostGIS test database is required — same schema, database name: gist_test
  • IpfsService and SorobanService should be mocked using NestJS overrideProvider
  • Run with: npm run test:e2e

Requirements

Create the following test suites:

Suite 1: POST /gists

  • Creates a gist with valid payload — expects 201 with id, gist_id, tx_hash, content_cid
  • Rejects missing lat — expects 400
  • Rejects invalid authorAddress — expects 400
  • Rejects text over 280 characters — expects 400

Suite 2: GET /gists

  • Returns gists within radius of seeded coordinates
  • Does NOT return gists outside the radius
  • Does NOT return expired gists
  • Returns results sorted by distance ascending
  • Pagination cursor returns correct next page

Suite 3: GET /gists/:id

  • Returns correct gist by UUID
  • Returns 404 for unknown UUID
  • Returns 404 for expired gist

Suite 4: GET /gists/:id/content

  • Returns IPFS content for valid gist
  • Returns 404 for unknown gist

Suite 5: GET /gists/count

  • Returns correct count within radius
  • Excludes expired gists from count

Suite 6: GET /health

  • Returns status ok with 200

Files to Touch

  • Backend/test/gists.e2e-spec.ts — main test file
  • Backend/test/setup.ts — test database setup and teardown
  • Backend/test/mocks/ipfs.service.mock.ts — mock IpfsService
  • Backend/test/mocks/soroban.service.mock.ts — mock SorobanService
  • Backend/test/jest-e2e.json — confirm config is correct

Acceptance Criteria

  • All test suites pass with npm run test:e2e
  • Tests use a real PostGIS database — not mocked
  • IpfsService and SorobanService are mocked
  • Tests clean up seeded data after each suite
  • Minimum 20 test cases total
  • No hardcoded local paths — CI-ready

Complexity: 350 points

Metadata

Metadata

Assignees

No one assigned

    Labels

    BackendBackend issues

    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