From c669fc08eb8cc6b66166d76edaab43affc5ed526 Mon Sep 17 00:00:00 2001 From: roschaefer Date: Mon, 23 Sep 2019 13:47:43 +0200 Subject: [PATCH 1/2] Fix intermittent backend specs @mattwr18 I still see those false positives. This should fix it. --- backend/src/schema/resolvers/notifications.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/schema/resolvers/notifications.spec.js b/backend/src/schema/resolvers/notifications.spec.js index 3a1c23d23..500ea98ca 100644 --- a/backend/src/schema/resolvers/notifications.spec.js +++ b/backend/src/schema/resolvers/notifications.spec.js @@ -192,7 +192,7 @@ describe('given some notifications', () => { it('returns only unread notifications of current user', async () => { const expected = expect.objectContaining({ data: { - notifications: [ + notifications: expect.arrayContaining([ { from: { __typename: 'Comment', @@ -209,7 +209,7 @@ describe('given some notifications', () => { read: false, createdAt: '2019-08-31T17:33:48.651Z', }, - ], + ]), }, }) await expect( From c24876c922d7bfe1673d29ab4496cc6cf3940e9f Mon Sep 17 00:00:00 2001 From: roschaefer Date: Mon, 23 Sep 2019 13:51:21 +0200 Subject: [PATCH 2/2] Add a double-check just to be sure --- backend/src/schema/resolvers/notifications.spec.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/src/schema/resolvers/notifications.spec.js b/backend/src/schema/resolvers/notifications.spec.js index 500ea98ca..1b9cac102 100644 --- a/backend/src/schema/resolvers/notifications.spec.js +++ b/backend/src/schema/resolvers/notifications.spec.js @@ -212,9 +212,12 @@ describe('given some notifications', () => { ]), }, }) - await expect( - query({ query: notificationQuery, variables: { ...variables, read: false } }), - ).resolves.toMatchObject(expected) + const response = await query({ + query: notificationQuery, + variables: { ...variables, read: false }, + }) + await expect(response).toMatchObject(expected) + await expect(response.data.notifications.length).toEqual(2) // double-check }) describe('if a resource gets deleted', () => {