Skip to content

Commit 0b19eba

Browse files
committed
Add Atlas search tests
1 parent 29fa2a7 commit 0b19eba

1 file changed

Lines changed: 35 additions & 1 deletion

File tree

memex/src/test/resources/features/inspections.feature

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,4 +317,38 @@ Feature: Vehicle Inspection API Management
317317
And the "Transfer-Encoding" header should be "chunked"
318318
And the "Content-Type" header should be "application/json"
319319
And the response should contain "testid": 2006
320-
And the response should contain "combined.vehicle.model": "Focus"
320+
And the response should contain "combined.vehicle.model": "Focus"
321+
322+
@post @atlas_search @sunny_day
323+
Scenario: Successfully execute an Atlas Search query
324+
Given the following vehicle inspections exist:
325+
| testid | vehicle.model |
326+
| 1001 | Corolla |
327+
When I send a POST request to "/api/inspections/search" with the payload:
328+
"""
329+
{
330+
"search": {
331+
"text": {
332+
"query": "Corolla",
333+
"path": "vehicle.model"
334+
}
335+
},
336+
"projection": {
337+
"_id": 1,
338+
"vehicle": 1,
339+
"score": { "$meta": "searchScore" }
340+
}
341+
}
342+
"""
343+
Then the response status code should be 200
344+
And the response should be a non empty JSON array
345+
And each item in the response array should contain "vehicle.model": "Corolla"
346+
347+
# Uncomment once the code is fixed
348+
# @post @atlas_search @rainy_day
349+
# Scenario: Fail to execute an Atlas Search query due to invalid syntax
350+
# When I send a POST request to "/api/inspections/search" with the payload:
351+
# """
352+
# { "search": { "invalid_field": "value" } }
353+
# """
354+
# Then the response status code should be 500

0 commit comments

Comments
 (0)