From 5f38c74d82ac0c91a9985f652b634da8239b7a99 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 16 Mar 2023 16:08:33 +0100 Subject: [PATCH] fix flaky test --- .../notificationsMiddleware.spec.js | 2 +- .../schema/resolvers/notifications.spec.js | 26 ++++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/backend/src/middleware/notifications/notificationsMiddleware.spec.js b/backend/src/middleware/notifications/notificationsMiddleware.spec.js index 50c423275..a9046b09f 100644 --- a/backend/src/middleware/notifications/notificationsMiddleware.spec.js +++ b/backend/src/middleware/notifications/notificationsMiddleware.spec.js @@ -859,6 +859,6 @@ describe('notifications', () => { errors: undefined, }) }) - }) + }) }) }) diff --git a/backend/src/schema/resolvers/notifications.spec.js b/backend/src/schema/resolvers/notifications.spec.js index 47134aea6..9deaea457 100644 --- a/backend/src/schema/resolvers/notifications.spec.js +++ b/backend/src/schema/resolvers/notifications.spec.js @@ -397,18 +397,20 @@ describe('given some notifications', () => { it('returns all as read', async () => { const response = await mutate({ mutation: markAllAsReadMutation(), variables }) - 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.data.markAllAsRead).toEqual( + expect.arrayContaining([ + { + 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() }) })