From 73d8ce0b1cb206124977e3338112054439534ecc Mon Sep 17 00:00:00 2001 From: Matthew Zikherman Date: Thu, 12 Apr 2018 18:16:54 -0400 Subject: [PATCH] Match stitched mutation output --- .../me/__tests__/recently_viewed_artworks.test.js | 6 +++--- src/schema/me/recently_viewed_artworks.ts | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/schema/me/__tests__/recently_viewed_artworks.test.js b/src/schema/me/__tests__/recently_viewed_artworks.test.js index c3192d2d7b..1b733651e6 100644 --- a/src/schema/me/__tests__/recently_viewed_artworks.test.js +++ b/src/schema/me/__tests__/recently_viewed_artworks.test.js @@ -94,15 +94,15 @@ describe("RecentlyViewedArtworks", () => { const mutation = gql` mutation { recordArtworkView(input: { artwork_id: "percy" }) { - success + artwork_id } } ` expect.assertions(1) return runAuthenticatedQuery(mutation, rootValue).then( - ({ recordArtworkView: { success } }) => { - expect(success).toEqual(true) + ({ recordArtworkView: { artwork_id } }) => { + expect(artwork_id).toEqual("percy") } ) }) diff --git a/src/schema/me/recently_viewed_artworks.ts b/src/schema/me/recently_viewed_artworks.ts index cd6e59ccdf..f906d3b654 100644 --- a/src/schema/me/recently_viewed_artworks.ts +++ b/src/schema/me/recently_viewed_artworks.ts @@ -40,9 +40,9 @@ export const recordArtworkViewMutation = mutationWithClientMutationId({ }, }, outputFields: { - success: { - type: GraphQLBoolean, - resolve: () => true, + artwork_id: { + type: new GraphQLNonNull(GraphQLString), + resolve: ({ artwork_id }) => artwork_id, }, }, mutateAndGetPayload: ( @@ -55,6 +55,8 @@ export const recordArtworkViewMutation = mutationWithClientMutationId({ "Missing recordArtworkViewLoader. Check that `X-Access-Token` and `X-User-Id` headers are set." ) } - return recordArtworkViewLoader({ artwork_id }) + return recordArtworkViewLoader({ artwork_id }).then(() => { + return { artwork_id } + }) }, })