From 3d74401ba5ff86bbb265cfb04130e33e4787fce4 Mon Sep 17 00:00:00 2001 From: tkt <37575408+tktcorporation@users.noreply.github.com> Date: Mon, 10 Oct 2022 10:12:05 +0000 Subject: [PATCH] :sparkles: finish https://redwoodjs.com/docs/tutorial/chapter6/comments-schema#creating-the-sdl-and-service --- api/src/graphql/comments.sdl.ts | 2 +- web/src/components/CommentsCell/CommentsCell.test.tsx | 1 + web/src/components/CommentsCell/CommentsCell.tsx | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/api/src/graphql/comments.sdl.ts b/api/src/graphql/comments.sdl.ts index cb6f63acb..272a67092 100644 --- a/api/src/graphql/comments.sdl.ts +++ b/api/src/graphql/comments.sdl.ts @@ -9,7 +9,7 @@ export const schema = gql` } type Query { - comments: [Comment!]! @requireAuth + comments: [Comment!]! @skipAuth } input CreateCommentInput { diff --git a/web/src/components/CommentsCell/CommentsCell.test.tsx b/web/src/components/CommentsCell/CommentsCell.test.tsx index 4532426ee..c44ac6858 100644 --- a/web/src/components/CommentsCell/CommentsCell.test.tsx +++ b/web/src/components/CommentsCell/CommentsCell.test.tsx @@ -19,6 +19,7 @@ describe('CommentsCell', () => { it('renders Empty successfully', async () => { expect(() => { render() + expect(screen.getByText('No comments yet')).toBeInTheDocument() }).not.toThrow() }) diff --git a/web/src/components/CommentsCell/CommentsCell.tsx b/web/src/components/CommentsCell/CommentsCell.tsx index 7bb69bf10..024e862e5 100644 --- a/web/src/components/CommentsCell/CommentsCell.tsx +++ b/web/src/components/CommentsCell/CommentsCell.tsx @@ -17,7 +17,9 @@ export const QUERY = gql` export const Loading = () =>
Loading...
-export const Empty = () =>
Empty
+export const Empty = () => ( +
No comments yet
+) export const Failure = ({ error }: CellFailureProps) => (
Error: {error?.message}