Added test for shoutedByCurrentUser flag on posts

This commit is contained in:
Grzegorz Leoniec 2019-03-05 18:34:35 +01:00
parent a292a522e9
commit 4fdb1562f9
No known key found for this signature in database
GPG Key ID: 3AA43686D4EB1377

View File

@ -69,6 +69,16 @@ describe('shout ', () => {
shout: true shout: true
} }
expect(res).toMatchObject(expected) 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 () => { it('I unshout a post of another user', async () => {
@ -82,6 +92,16 @@ describe('shout ', () => {
// unshout // unshout
const res = await clientUser1.request(mutationUnshoutPost('p2')) const res = await clientUser1.request(mutationUnshoutPost('p2'))
expect(res).toMatchObject(expected) 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 () => { it('I can`t shout my own post', async () => {
@ -92,6 +112,16 @@ describe('shout ', () => {
shout: false shout: false
} }
expect(res).toMatchObject(expected) expect(res).toMatchObject(expected)
const { Post } = await clientUser1.request(`{
Post(id: "p1") {
shoutedByCurrentUser
}
}`)
const expected2 = {
shoutedByCurrentUser: false
}
expect(Post[0]).toMatchObject(expected2)
}) })
}) })
}) })