mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
add test case for if next stop object does not exist
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user