Skip to content

Add integration tests for POST /api/streams – validation and event recording #233

@ritik4ever

Description

@ritik4ever

The POST /api/streams route validates the request body and creates a stream in SQLite. There are no integration tests verifying that all documented validation rules are enforced and that the created event appears in the stream's history.

Implementation:
Create tests in backend/src/index.test.ts or a dedicated file:

  • Valid payload → assert 201 with full stream shape and created event in history
  • Missing sender → assert 400 with field-level error
  • durationSeconds < 60 → assert 400 with minimum duration message
  • Unknown assetCode not in ALLOWED_ASSETS → assert 400
  • totalAmount <= 0 → assert 400

Acceptance Criteria:

  • All five validation rules are tested
  • 201 response includes computed progress field
  • created event is verifiable via GET /api/streams/:id/history after creation

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions