Skip to content

Commit

Permalink
Merge pull request #1005 from artsy/match_mutation_return_type
Browse files Browse the repository at this point in the history
@mzikherman => Match stitched mutation output
  • Loading branch information
mzikherman authored Apr 13, 2018
2 parents 4682eec + 73d8ce0 commit 36fe444
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/schema/me/__tests__/recently_viewed_artworks.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
)
})
Expand Down
10 changes: 6 additions & 4 deletions src/schema/me/recently_viewed_artworks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: (
Expand All @@ -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 }
})
},
})

0 comments on commit 36fe444

Please sign in to comment.