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 () = { + + }) +}) })