Skip to content

Commit

Permalink
Add test for handling OR logic in legacy search
Browse files Browse the repository at this point in the history
This commit introduces a new test, `shouldHandleORRequest`, to verify the OR logic within the legacy search functionality. It ensures that the query with an OR condition is processed correctly, and the results are returned as expected without errors.
  • Loading branch information
Gcolon021 committed Nov 19, 2024
1 parent 18218a2 commit a76e0c3
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,21 @@ void shouldGetLegacyResponseByStudyID() throws IOException {
searchResults.forEach(searchResult -> Assertions.assertEquals("phs000007", searchResult.result().studyId()));
}

@Test
void shouldHandleORRequest() throws IOException {
String jsonString = """
{"query":{"searchTerm":"physical|age","includedTags":[],"excludedTags":[],"returnTags":"true","offset":0,"limit":100}}
""";

ResponseEntity<LegacyResponse> legacyResponseResponseEntity = legacySearchController.legacySearch(jsonString);
System.out.println(legacyResponseResponseEntity);
Assertions.assertEquals(HttpStatus.OK, legacyResponseResponseEntity.getStatusCode());
LegacyResponse legacyResponseBody = legacyResponseResponseEntity.getBody();
Assertions.assertNotNull(legacyResponseBody);
Results results = legacyResponseBody.results();
List<SearchResult> searchResults = results.searchResults();
System.out.println(searchResults);
}


}

0 comments on commit a76e0c3

Please sign in to comment.