From 4fdb1562f9c58b63e58fc46a69f6fd06e84aba4c Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Tue, 5 Mar 2019 18:34:35 +0100 Subject: [PATCH] Added test for shoutedByCurrentUser flag on posts --- src/resolvers/shout.spec.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/resolvers/shout.spec.js b/src/resolvers/shout.spec.js index 4f5ea6ed6..440210720 100644 --- a/src/resolvers/shout.spec.js +++ b/src/resolvers/shout.spec.js @@ -69,6 +69,16 @@ describe('shout ', () => { shout: true } expect(res).toMatchObject(expected) + + const { Post } = await clientUser1.request(`{ + Post(id: "p2") { + shoutedByCurrentUser + } + }`) + const expected2 = { + shoutedByCurrentUser: true + } + expect(Post[0]).toMatchObject(expected2) }) it('I unshout a post of another user', async () => { @@ -82,6 +92,16 @@ describe('shout ', () => { // unshout const res = await clientUser1.request(mutationUnshoutPost('p2')) expect(res).toMatchObject(expected) + + const { Post } = await clientUser1.request(`{ + Post(id: "p2") { + shoutedByCurrentUser + } + }`) + const expected2 = { + shoutedByCurrentUser: false + } + expect(Post[0]).toMatchObject(expected2) }) it('I can`t shout my own post', async () => { @@ -92,6 +112,16 @@ describe('shout ', () => { shout: false } expect(res).toMatchObject(expected) + + const { Post } = await clientUser1.request(`{ + Post(id: "p1") { + shoutedByCurrentUser + } + }`) + const expected2 = { + shoutedByCurrentUser: false + } + expect(Post[0]).toMatchObject(expected2) }) }) })