diff --git a/backend/src/schema/resolvers/moderation.spec.js b/backend/src/schema/resolvers/moderation.spec.js index 64d39ecd1..208332b79 100644 --- a/backend/src/schema/resolvers/moderation.spec.js +++ b/backend/src/schema/resolvers/moderation.spec.js @@ -179,11 +179,35 @@ describe('disable', () => { id: 'sample-post-id', }) }) - + const postQuery = gql` + query($id: ID) { + Post(id: $id) { + id + disabledBy { + id + } + } + } + ` it('returns disabled resource id', async () => { variables = { id: 'sample-post-id' } - const expected = { data: { disable: 'sample-post-id' } } - await expect(mutate({ mutation, variables })).resolves.toMatchObject(expected) + await expect(mutate({ mutation, variables })).resolves.toMatchObject({ + data: { disable: 'sample-post-id' }, + }) + }) + + it.only('changes .disabledBy', async () => { + variables = { id: 'sample-post-id' } + const before = { data: { Post: [{ id: 'sample-post-id', disabledBy: null }] } } + const expected = { + data: { Post: [{ id: 'sample-post-id', disabledBy: { id: 'moderator-id' } }] }, + } + + await expect(query({ query: postQuery, variables })).resolves.toMatchObject(before) + await expect(mutate({ mutation, variables })).resolves.toMatchObject({ + data: { disable: 'sample-post-id' }, + }) + await expect(query({ query: postQuery, variables })).resolves.toMatchObject(expected) }) }) }) @@ -213,12 +237,6 @@ describe('disable', () => { // } // }) - // it('returns disabled resource id', async () => { - // const expected = { disable: 'p9' } - // await setup() - // await expect(action()).resolves.toEqual(expected) - // }) - // it('changes .disabledBy', async () => { // const before = { Post: [{ id: 'p9', disabledBy: null }] } // const expected = { Post: [{ id: 'p9', disabledBy: { id: 'u7' } }] }