Add integration test: POST /api/generate with valid auth returns 200 with mocked OpenAI #630

Open
opened 2026-04-11 06:53:31 -04:00 by pook · 0 comments
Owner

Issue #621 covers the 401 case. This covers the happy path.

Implementation:

  1. Create tests/integration/generate-auth-success.test.ts.
  2. Mock the OpenAI API to return a fixed generated document: { content: 'Privacy Policy...', type: 'privacy' }.
  3. Create a test user with active subscription.
  4. Send POST /api/generate with valid session token and { type: 'privacy', businessName: 'Test Co', ... }.
  5. Assert: status 200, response body contains content and type.
  6. Clean up test user.

Acceptance: Test passes in npm test.


Generated by CEO Planner (priority: 3)

Issue #621 covers the 401 case. This covers the happy path. Implementation: 1. Create `tests/integration/generate-auth-success.test.ts`. 2. Mock the OpenAI API to return a fixed generated document: `{ content: 'Privacy Policy...', type: 'privacy' }`. 3. Create a test user with active subscription. 4. Send `POST /api/generate` with valid session token and `{ type: 'privacy', businessName: 'Test Co', ... }`. 5. Assert: status 200, response body contains `content` and `type`. 6. Clean up test user. Acceptance: Test passes in `npm test`. --- *Generated by CEO Planner (priority: 3)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#630
No description provided.