diff --git a/backend/src/schema/resolvers/notifications.spec.js b/backend/src/schema/resolvers/notifications.spec.js index d4805bfc9..5caccd110 100644 --- a/backend/src/schema/resolvers/notifications.spec.js +++ b/backend/src/schema/resolvers/notifications.spec.js @@ -300,6 +300,7 @@ describe('given some notifications', () => { } } ` + describe('unauthenticated', () => { it('throws authorization error', async () => { const result = await mutate({ @@ -393,6 +394,7 @@ describe('given some notifications', () => { }) }) }) + describe('markAllAsRead', () => { const markAllAsReadMutation = gql` mutation { @@ -411,6 +413,7 @@ describe('given some notifications', () => { } } ` + describe('unauthenticated', () => { it('throws authorization error', async () => { const result = await mutate({ @@ -432,9 +435,20 @@ describe('given some notifications', () => { } }) - it('returns undefined', async () => { + it('returns all as read', async () => { const response = await mutate({ mutation: markAllAsReadMutation, variables }) - expect(response.data.markAsRead).toEqual(undefined) + expect(response.data.markAllAsRead).toEqual([ + { + createdAt: '2019-08-30T19:33:48.651Z', + from: { __typename: 'Comment', content: 'You have been mentioned in a comment' }, + read: true, + }, + { + createdAt: '2019-08-31T17:33:48.651Z', + from: { __typename: 'Post', content: 'You have been mentioned in a post' }, + read: true, + }, + ]) expect(response.errors).toBeUndefined() }) }) diff --git a/webapp/pages/notifications/index.spec.js b/webapp/pages/notifications/index.spec.js index e9cea64a7..8b0f33693 100644 --- a/webapp/pages/notifications/index.spec.js +++ b/webapp/pages/notifications/index.spec.js @@ -97,6 +97,7 @@ describe('PostIndex', () => { it('refreshes the notificaitons', () => { expect(mocks.$apollo.queries.notifications.refresh).toHaveBeenCalledTimes(1) }) + it('click on `mark all as read` button', async () => { await markAllAsReadButton.trigger('click') expect(mocks.$apollo.mutate).not.toHaveBeenCalled()