From 788979eedfd82cda726ba2d69b821c43c98fd6bf Mon Sep 17 00:00:00 2001 From: ALau2088 Date: Wed, 5 Jun 2019 18:12:22 -0700 Subject: [PATCH] add update comment jest test --- backend/src/middleware/validation/index.js | 3 ++- backend/src/resolvers/comments.spec.js | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/backend/src/middleware/validation/index.js b/backend/src/middleware/validation/index.js index a7238ab03..2da25a605 100644 --- a/backend/src/middleware/validation/index.js +++ b/backend/src/middleware/validation/index.js @@ -37,7 +37,8 @@ const validateComment = async (resolve, root, args, context, info) => { if (!postId) { throw new UserInputError(NO_POST_ERR_MESSAGE) } - return resolve(root, args, context, info) + /* eslint-disable-next-line no-return-await */ + return await resolve(root, args, context, info) } export default { diff --git a/backend/src/resolvers/comments.spec.js b/backend/src/resolvers/comments.spec.js index 87a0df270..952850759 100644 --- a/backend/src/resolvers/comments.spec.js +++ b/backend/src/resolvers/comments.spec.js @@ -175,4 +175,24 @@ describe('CreateComment', () => { expect(Comment).toEqual([{ postId: null }]) }) }) + +describe('UpdateComment', () => { + const updateCommentMutation = ` + mutation($postId: ID, $content: String!, $id: ID!) { + UpdateComment(postId: $postId, content: $content, id: $id) { + id + content + } + } + ` + updateCommentVariables = { + postId: 'p1', + content: 'Comment is updated', + id: 'c8' + } + + it('updates a comment', async () = { + + }) +}) })