You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: server/express/tests/integration/README.md
+67-15Lines changed: 67 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,40 +1,67 @@
1
1
# Integration Tests
2
2
3
-
This directory contains integration tests for the Express MongoDB application. Unlike unit tests, these tests connect to
4
-
a real MongoDB instance to verify end-to-end functionality.
3
+
This directory contains integration tests for the Express MongoDB application. Unlike unit tests, these tests make actual HTTP requests to the Express app using `supertest` and connect to a real MongoDB instance to verify end-to-end functionality.
5
4
6
5
## Overview
7
6
8
-
The integration tests are organized into two main categories:
7
+
The integration tests are organized into three main categories:
- Vector Search tests require `VOYAGE_API_KEY` to be set
30
+
31
+
**Note:** Tests use `describeIntegration`, `describeSearch`, and `describeVectorSearch` wrappers (from `setup.ts` and test files) that automatically skip entire test suites when the required environment variables are not set.
32
+
33
+
## Testing Approach
34
+
35
+
These integration tests use **supertest** to make actual HTTP requests to the Express application, testing the complete request/response cycle including:
36
+
- Routing
37
+
- Request parsing
38
+
- Controller logic
39
+
- Database operations
40
+
- Response formatting
41
+
- Error handling
42
+
43
+
This approach ensures that the API endpoints work correctly from the client's perspective.
24
44
25
45
## Requirements
26
46
27
-
### Basic Integration Tests
47
+
### Basic Integration Tests (CRUD and Aggregations)
28
48
29
49
-**MONGODB_URI** environment variable must be set
30
50
- MongoDB instance must be accessible (can be local MongoDB or Atlas)
31
51
32
-
### Search Tests
52
+
### Atlas Search Tests
33
53
34
54
-**MongoDB instance** with Search enabled (local MongoDB or Atlas)
35
55
-**MONGODB_URI** environment variable
36
56
-**ENABLE_SEARCH_TESTS=true** environment variable to enable tests
37
57
58
+
### Vector Search Tests
59
+
60
+
-**MONGODB_URI** environment variable must be set
61
+
-**VOYAGE_API_KEY** environment variable must be set with a valid Voyage AI API key
62
+
- MongoDB instance must have the `embedded_movies` collection with vector embeddings
63
+
- Vector search index must be configured on the `embedded_movies` collection
64
+
38
65
## Running the Tests
39
66
40
67
### Run All Integration Tests
@@ -51,6 +78,9 @@ npx jest --config jest.integration.config.json tests/integration/movie.integrati
51
78
52
79
# Run only Search tests (requires Search-enabled MongoDB)
53
80
npx jest --config jest.integration.config.json tests/integration/mongodbSearch.integration.test.ts
81
+
82
+
# Run only Advanced Endpoints tests (aggregations, search, vector search)
83
+
npx jest --config jest.integration.config.json tests/integration/advancedEndpoints.integration.test.ts
0 commit comments