diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-11-28 15:48:25 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-11-28 18:04:24 +0100 |
| commit | 180134883b281883246fc9909b1d494363861144 (patch) | |
| tree | bf108c3c2961616c9af808b9810345fc6cd23ffe /tests/msw/schema/types | |
| parent | fb749e8befb2dcdc266c2e8b7ef7c9001947143a (diff) | |
test(services): add tests for comments list fetcher
Diffstat (limited to 'tests/msw/schema/types')
| -rw-r--r-- | tests/msw/schema/types/author.types.ts | 15 | ||||
| -rw-r--r-- | tests/msw/schema/types/comment.types.ts | 74 | ||||
| -rw-r--r-- | tests/msw/schema/types/common.types.ts | 13 | ||||
| -rw-r--r-- | tests/msw/schema/types/index.ts | 9 |
4 files changed, 97 insertions, 14 deletions
diff --git a/tests/msw/schema/types/author.types.ts b/tests/msw/schema/types/author.types.ts index bbb50a4..53c0bb7 100644 --- a/tests/msw/schema/types/author.types.ts +++ b/tests/msw/schema/types/author.types.ts @@ -1,17 +1,4 @@ -export const authorTypes = `enum AvatarRatingEnum { - G - PG - R - X -} - -type Avatar { - height: Int - url: String - width: Int -} - -type User { +export const authorTypes = `type User { avatar( forceDefault: Boolean rating: AvatarRatingEnum diff --git a/tests/msw/schema/types/comment.types.ts b/tests/msw/schema/types/comment.types.ts new file mode 100644 index 0000000..00cff77 --- /dev/null +++ b/tests/msw/schema/types/comment.types.ts @@ -0,0 +1,74 @@ +export const commentTypes = `enum CommentsConnectionOrderbyEnum { + COMMENT_AGENT + COMMENT_APPROVED + COMMENT_AUTHOR + COMMENT_AUTHOR_EMAIL + COMMENT_AUTHOR_IP + COMMENT_AUTHOR_URL + COMMENT_CONTENT + COMMENT_DATE + COMMENT_DATE_GMT + COMMENT_ID + COMMENT_IN + COMMENT_KARMA + COMMENT_PARENT + COMMENT_POST_ID + COMMENT_TYPE + USER_ID +} + +type Commenter { + avatar: Avatar + name: String + url: String +} + +type CommentToCommenterConnectionEdge { + cursor: String + node: Commenter! +} + +enum CommentStatusEnum { + APPROVE + HOLD + SPAM + TRASH +} + +type Comment { + approved: Boolean + author: CommentToCommenterConnectionEdge + content(format: PostObjectFieldFormatEnum): String + databaseId: Int! + date: String + parentDatabaseId: Int + status: CommentStatusEnum +} + +input RootQueryToCommentConnectionWhereArgs { + contentId: ID + contentName: String + order: OrderEnum + orderby: CommentsConnectionOrderbyEnum + parent: Int + status: String +} + +type RootQueryToCommentConnectionPageInfo { + endCursor: String + hasNextPage: Boolean! + hasPreviousPage: Boolean! + startCursor: String + total: Int +} + +type RootQueryToCommentConnectionEdge { + cursor: String + node: Comment! +} + +type RootQueryToCommentConnection { + edges: [RootQueryToCommentConnectionEdge!]! + nodes: [Comment!]! + pageInfo: RootQueryToCommentConnectionPageInfo! +}`; diff --git a/tests/msw/schema/types/common.types.ts b/tests/msw/schema/types/common.types.ts index 23baeb3..03e066c 100644 --- a/tests/msw/schema/types/common.types.ts +++ b/tests/msw/schema/types/common.types.ts @@ -21,6 +21,19 @@ enum PostObjectsConnectionOrderbyEnum { TITLE } +enum AvatarRatingEnum { + G + PG + R + X +} + +type Avatar { + height: Int + url: String + width: Int +} + type ContentPartsType { afterMore(format: PostObjectFieldFormatEnum): String beforeMore(format: PostObjectFieldFormatEnum): String diff --git a/tests/msw/schema/types/index.ts b/tests/msw/schema/types/index.ts index 163955b..c34cacd 100644 --- a/tests/msw/schema/types/index.ts +++ b/tests/msw/schema/types/index.ts @@ -1,4 +1,5 @@ import { authorTypes } from './author.types'; +import { commentTypes } from './comment.types'; import { commonTypes } from './common.types'; import { featuredImageTypes } from './featured-image.types'; import { postTypes } from './post.types'; @@ -6,6 +7,13 @@ import { thematicTypes } from './thematic.types'; import { topicTypes } from './topic.types'; const rootQueryType = `type Query { + comments( + after: String + before: String + first: Int + last: Int + where: RootQueryToCommentConnectionWhereArgs + ): RootQueryToCommentConnection post( asPreview: Boolean id: ID! @@ -22,6 +30,7 @@ const rootQueryType = `type Query { export const types = [ authorTypes, + commentTypes, commonTypes, featuredImageTypes, postTypes, |
