add test case for null next stop

This commit is contained in:
2025-01-28 14:47:33 -08:00
parent e079c0283e
commit 151281a17f
2 changed files with 28 additions and 4 deletions

View File

@@ -107,7 +107,26 @@ describe("OrderedStopResolvers", () => {
});
it("returns null if there is no next stop in the repository", async () => {
const orderedStops = await setUpOrderedStopsInRepository();
orderedStops[0].nextStop = undefined;
await repository.addOrUpdateOrderedStop(orderedStops[0]);
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();
});
it("returns null if the current stop no longer exists", async () => {