From 5687f7f60030df278602b4fbce9e8f123c345dd4 Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Tue, 4 Feb 2025 11:19:58 -0800 Subject: [PATCH] add second test if shuttle ID doesn't exist in repository --- test/resolvers/MutationResolverTests.test.ts | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/resolvers/MutationResolverTests.test.ts b/test/resolvers/MutationResolverTests.test.ts index 9e8b887..f7342fd 100644 --- a/test/resolvers/MutationResolverTests.test.ts +++ b/test/resolvers/MutationResolverTests.test.ts @@ -41,6 +41,8 @@ describe("MutationResolvers", () => { variables: { input: notificationInput, } + }, { + contextValue: context, }); assert(response.body.kind === "single"); @@ -52,7 +54,26 @@ describe("MutationResolvers", () => { }); it("fails if the shuttle ID doesn't exist", async () => { + const system = await addMockSystemToRepository(context.repository); + const stop = await addMockStopToRepository(context.repository, system.id); + const notificationInput = { + deviceId: "1", + shuttleId: "1", + stopId: stop.id, + } + const response = await holder.testServer.executeOperation({ + query, + variables: { + input: notificationInput, + } + }, { + contextValue: context + }); + + assert(response.body.kind === "single"); + expect(response.body.singleResult.errors).toBeUndefined(); + expect(response.body.singleResult.data?.success).toBe(false); }); it("fails if the stop ID doesn't exist", async () => {