add test case for if next stop object does not exist

This commit is contained in:
2025-01-28 14:52:10 -08:00
parent 151281a17f
commit d423cdb95b

View File

@@ -129,8 +129,26 @@ describe("OrderedStopResolvers", () => {
expect(nonexistentNextStop).toBeNull();
});
it("returns null if the current stop no longer exists", async () => {
it("returns null if the next stop object no longer exists", async () => {
const orderedStops = await setUpOrderedStopsInRepository();
await repository.removeStopIfExists(orderedStops[1].stopId);
const response = await testServer.executeOperation({
query,
variables: {
systemId: mockSystem.id,
routeId: mockRoute.id,
stopId: orderedStops[0].stopId,
},
}, {
contextValue: {
repository,
}
});
assert(response.body.kind === "single");
const nonexistentNextStop = (response.body.singleResult.data?.system as any).route.orderedStop.nextStop;
expect(nonexistentNextStop).toBeNull();
});
});