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
The
POST /api/streamsroute 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 thecreatedevent appears in the stream's history.Implementation:
Create tests in
backend/src/index.test.tsor a dedicated file:createdevent in historysender→ assert 400 with field-level errordurationSeconds < 60→ assert 400 with minimum duration messageassetCodenot in ALLOWED_ASSETS → assert 400totalAmount <= 0→ assert 400Acceptance Criteria:
progressfieldcreatedevent is verifiable viaGET /api/streams/:id/historyafter creation