From 1c20e06da5a9817c15c80ca5a25cfacf8eeb0485 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Mon, 11 Dec 2023 18:47:59 +0100 Subject: test(services): add tests for createComment mutation * add Jest test * add a Cypress test in article pages spec --- tests/msw/schema/types/create-comment.types.ts | 19 +++++++++++++++++++ tests/msw/schema/types/index.ts | 3 +++ 2 files changed, 22 insertions(+) create mode 100644 tests/msw/schema/types/create-comment.types.ts (limited to 'tests/msw/schema') diff --git a/tests/msw/schema/types/create-comment.types.ts b/tests/msw/schema/types/create-comment.types.ts new file mode 100644 index 0000000..31fc54d --- /dev/null +++ b/tests/msw/schema/types/create-comment.types.ts @@ -0,0 +1,19 @@ +export const createCommentTypes = `input CreateCommentInput { + approved: String + author: String + authorEmail: String + authorUrl: String + clientMutationId: String + commentOn: Int + content: String + date: String + parent: ID + status: CommentStatusEnum + type: String +} + +type CreateCommentPayload { + clientMutationId: String + comment: Comment + success: Boolean +}`; diff --git a/tests/msw/schema/types/index.ts b/tests/msw/schema/types/index.ts index 1063772..e1d260a 100644 --- a/tests/msw/schema/types/index.ts +++ b/tests/msw/schema/types/index.ts @@ -1,6 +1,7 @@ import { authorTypes } from './author.types'; import { commentTypes } from './comment.types'; import { commonTypes } from './common.types'; +import { createCommentTypes } from './create-comment.types'; import { featuredImageTypes } from './featured-image.types'; import { postTypes } from './post.types'; import { sendEmailTypes } from './send-email.types'; @@ -54,6 +55,7 @@ const rootQueryType = `type Query { }`; const rootMutationType = `type Mutation { + createComment(input: CreateCommentInput!): CreateCommentPayload sendEmail(input: SendEmailInput!): SendEmailPayload }`; @@ -61,6 +63,7 @@ export const types = [ authorTypes, commentTypes, commonTypes, + createCommentTypes, featuredImageTypes, postTypes, sendEmailTypes, -- cgit v1.2.3