Skip to content

Commit d4a49c7

Browse files
fix(test): update QueryServiceTest stubs for nonEndpointIds batch change
findRelatedEndpoints now partitions search matches into direct endpoints (returned immediately) and non-endpoint nodes (passed to batch query). Two tests were stubbing findEndpointNeighborsBatch with List.of("ep:getUsers") but since ep:getUsers IS an endpoint, it never reaches the batch call — nonEndpointIds is empty. Update both tests to stub List.of() (the actual argument when all search results are direct endpoint matches). Co-Authored-By: Paperclip <noreply@paperclip.ing>
1 parent 56fb08c commit d4a49c7

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/test/java/io/github/randomcodespace/iq/query/QueryServiceTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,8 @@ void findRelatedEndpointsShouldUsesBatchQueryInsteadOfNPlusOne() {
571571
void findRelatedEndpointsShouldIncludeDirectEndpointMatches() {
572572
var endpointNode = makeNode("ep:getUsers", NodeKind.ENDPOINT, "getUsers");
573573
when(graphStore.search("getUsers", 50)).thenReturn(List.of(endpointNode));
574-
when(graphStore.findEndpointNeighborsBatch(List.of("ep:getUsers"))).thenReturn(Map.of());
574+
// Endpoint nodes are partitioned directly into the result list — nonEndpointIds is empty
575+
when(graphStore.findEndpointNeighborsBatch(List.of())).thenReturn(Map.of());
575576

576577
Map<String, Object> result = service.findRelatedEndpoints("getUsers");
577578

@@ -586,14 +587,13 @@ void findRelatedEndpointsShouldIncludeDirectEndpointMatches() {
586587
@Test
587588
void findRelatedEndpointsShouldDeduplicateEndpoints() {
588589
var endpointNode = makeNode("ep:getUsers", NodeKind.ENDPOINT, "getUsers");
589-
// Same endpoint appears as both a direct match and a neighbor
590+
// Endpoint node is a direct match — nonEndpointIds is empty, batch returns nothing
590591
when(graphStore.search("ep", 50)).thenReturn(List.of(endpointNode));
591-
when(graphStore.findEndpointNeighborsBatch(List.of("ep:getUsers")))
592-
.thenReturn(Map.of("ep:getUsers", List.of(endpointNode)));
592+
when(graphStore.findEndpointNeighborsBatch(List.of())).thenReturn(Map.of());
593593

594594
Map<String, Object> result = service.findRelatedEndpoints("ep");
595595

596-
// Should only appear once
596+
// Should appear exactly once (direct match)
597597
assertEquals(1, result.get("count"));
598598
}
599599

0 commit comments

Comments
 (0)