Hey Dude, #Democracy should work equal for everybody!? That seems to be the only way to have equal #Liberty for everyone.
' const postWithHastagsQuery = gql ` query($id: ID) { Post(id: $id) { tags { id name } } } ` const postWithHastagsVariables = { id: postId, } const createPostMutation = gql ` mutation($postId: ID, $postTitle: String!, $postContent: String!) { CreatePost(id: $postId, title: $postTitle, content: $postContent) { id title content } } ` describe('authenticated', () => { beforeEach(async () => { authenticatedUser = await user.toJson() }) describe('create a Post with Hashtags', () => { beforeEach(async () => { await mutate({ mutation: createPostMutation, variables: { postId, postTitle, postContent, }, }) }) it('both Hashtags are created with the "id" set to their "name"', async () => { const expected = [{ id: 'Democracy', name: 'Democracy' }, { id: 'Liberty', name: 'Liberty' }, ] await expect( query({ query: postWithHastagsQuery, variables: postWithHastagsVariables }), ).resolves.toEqual( expect.objectContaining({ data: { Post: [{ tags: expect.arrayContaining(expected), }, ], }, }), ) }) describe('afterwards update the Post by removing a Hashtag, leaving a Hashtag and add a Hashtag', () => { // The already existing Hashtag has no class at this point. const updatedPostContent = 'Hey Dude, #Elections should work equal for everybody!? That seems to be the only way to have equal #Liberty for everyone.
' const updatePostMutation = gql ` mutation($postId: ID!, $postTitle: String!, $updatedPostContent: String!) { UpdatePost(id: $postId, title: $postTitle, content: $updatedPostContent) { id title content } } ` it('only one previous Hashtag and the new Hashtag exists', async () => { await mutate({ mutation: updatePostMutation, variables: { postId, postTitle, updatedPostContent, }, }) const expected = [{ id: 'Elections', name: 'Elections' }, { id: 'Liberty', name: 'Liberty' }, ] await expect( query({ query: postWithHastagsQuery, variables: postWithHastagsVariables }), ).resolves.toEqual( expect.objectContaining({ data: { Post: [{ tags: expect.arrayContaining(expected) }], }, }), ) }) }) }) }) })