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
Complexity: 350 points
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
Requirements
Create the following test suites:
Suite 1: POST /gists
Suite 2: GET /gists
Suite 3: GET /gists/:id
Suite 4: GET /gists/:id/content
Suite 5: GET /gists/count
Suite 6: GET /health
Files to Touch
Acceptance Criteria
Complexity: 350 points