mgw / tests-prompts /api-tests.md
alessandro trinca tornidor
test: update playwright e2e tests because of the new /thesaurus-inflated-phrase agnostic response structure
7149fa6

Prompt for regenerating integration tests

Create a TypeScript script that downloads Swagger/OpenAPI definitions from the following URLs: http://localhost:3000/swagger.json Download the swagger file and save them to a local directory called 'swaggers' and use axios for the HTTP requests

Testing Pattern:

Generate TypeScript types or interfaces from the swagger schema Generate TypeScript helper utilities for:

  1. An error handler that uses util.inspect to handle circular references
  2. A request wrapper around axios that handles authentication and error enhancement

Testing Requirements:

Using the Typescript definition from swaggers folder, generate a complete Jest test suite with the following requirements:

  1. Use TypeScript with proper typing
  2. Include setup for dotenv configuration
  3. Implement tests for all CRUD operations
  4. Handle authentication via Bearer token from environment variables
  5. Include proper error handling with util.inspect for circular references
  6. Create helper functions for common test operations
  7. Implement test data cleanup after tests complete

Detailed Output

Create comprehensive error handling tests for the API endpoints in the Swagger definition. Include tests for:

  • Invalid input data
  • Missing required fields
  • Resource not found scenarios