File size: 1,307 Bytes
7149fa6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 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