From 4d74027b0e9e31172e3661fb843c7cb971aee29e Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Tue, 25 Mar 2025 16:16:18 -0700 Subject: [PATCH] update schema types for backwards compatibility with current schema --- schema.graphqls | 16 +++++----------- test/resolvers/MutationResolverTests.test.ts | 8 ++++---- test/resolvers/QueryResolverTests.test.ts | 2 +- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/schema.graphqls b/schema.graphqls index 0dcd118..6db52e7 100644 --- a/schema.graphqls +++ b/schema.graphqls @@ -65,23 +65,17 @@ type Query { systems: [System!]! system(id: ID): System - isNotificationScheduled(input: NotificationLookupArguments!): Boolean - secondsThresholdForNotification(input: NotificationLookupArguments!): Int + isNotificationScheduled(input: NotificationInput!): Boolean + secondsThresholdForNotification(input: NotificationInput!): Int } # Mutations type Mutation { - scheduleNotification(input: NotificationSchedulingArguments!): NotificationResponse! - cancelNotification(input: NotificationLookupArguments!): NotificationResponse! + scheduleNotification(input: NotificationInput!): NotificationResponse! + cancelNotification(input: NotificationInput!): NotificationResponse! } -input NotificationLookupArguments { - deviceId: ID! - shuttleId: ID! - stopId: ID! -} - -input NotificationSchedulingArguments { +input NotificationInput { deviceId: ID! shuttleId: ID! stopId: ID! diff --git a/test/resolvers/MutationResolverTests.test.ts b/test/resolvers/MutationResolverTests.test.ts index 83eb1ef..73eaae5 100644 --- a/test/resolvers/MutationResolverTests.test.ts +++ b/test/resolvers/MutationResolverTests.test.ts @@ -6,7 +6,7 @@ import { addMockSystemToRepository } from "../testHelpers/repositorySetupHelpers"; import assert = require("node:assert"); -import { NotificationSchedulingArguments } from "../../src/generated/graphql"; +import { NotificationInput } from "../../src/generated/graphql"; describe("MutationResolvers", () => { const holder = setupTestServerHolder() @@ -25,7 +25,7 @@ describe("MutationResolvers", () => { describe("scheduleNotification", () => { const query = ` - mutation ScheduleNotification($input: NotificationSchedulingArguments!) { + mutation ScheduleNotification($input: NotificationInput!) { scheduleNotification(input: $input) { success message @@ -38,7 +38,7 @@ describe("MutationResolvers", () => { } ` - function assertFailedResponse(response: any, notificationInput: NotificationSchedulingArguments) { + function assertFailedResponse(response: any, notificationInput: NotificationInput) { assert(response.body.kind === "single"); expect(response.body.singleResult.errors).toBeUndefined(); const notificationResponse = response.body.singleResult.data?.scheduleNotification as any; @@ -126,7 +126,7 @@ describe("MutationResolvers", () => { describe("cancelNotification", () => { const query = ` - mutation CancelNotification($input: NotificationLookupArguments!) { + mutation CancelNotification($input: NotificationInput!) { cancelNotification(input: $input) { success message diff --git a/test/resolvers/QueryResolverTests.test.ts b/test/resolvers/QueryResolverTests.test.ts index ba00f5b..00007a7 100644 --- a/test/resolvers/QueryResolverTests.test.ts +++ b/test/resolvers/QueryResolverTests.test.ts @@ -98,7 +98,7 @@ describe("QueryResolvers", () => { describe("isNotificationScheduled and secondsThresholdForNotification", () => { const query = ` - query IsNotificationScheduled($input: NotificationLookupArguments!) { + query IsNotificationScheduled($input: NotificationInput!) { isNotificationScheduled(input: $input) secondsThresholdForNotification(input: $input) }