From eacd81cb9c382c47693a87d1bd1816faa7d0a801 Mon Sep 17 00:00:00 2001 From: Philip Molares Date: Sun, 15 Jan 2023 22:16:41 +0100 Subject: [PATCH] fix(frontend): verify that callback could be run in create-non-existing-note-hint.test.tsx Signed-off-by: Philip Molares --- .../create-non-existing-note-hint.test.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/common/note-loading-boundary/create-non-existing-note-hint.test.tsx b/frontend/src/components/common/note-loading-boundary/create-non-existing-note-hint.test.tsx index 815ad9248..ad9815e95 100644 --- a/frontend/src/components/common/note-loading-boundary/create-non-existing-note-hint.test.tsx +++ b/frontend/src/components/common/note-loading-boundary/create-non-existing-note-hint.test.tsx @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) * * SPDX-License-Identifier: AGPL-3.0-only */ @@ -68,6 +68,7 @@ describe('create non existing note hint', () => { const onNoteCreatedCallback = jest.fn() const view = render() await screen.findByTestId('createNoteMessage') + await waitForOtherPromisesToFinish() expect(onNoteCreatedCallback).not.toBeCalled() expect(view.container).toMatchSnapshot() }) @@ -83,6 +84,7 @@ describe('create non existing note hint', () => { await waitFor(async () => { expect(await screen.findByTestId('loadingMessage')).toBeInTheDocument() }) + await waitForOtherPromisesToFinish() expect(onNoteCreatedCallback).not.toBeCalled() expect(view.container).toMatchSnapshot() }) @@ -98,6 +100,7 @@ describe('create non existing note hint', () => { await waitFor(async () => { expect(await screen.findByTestId('noteCreated')).toBeInTheDocument() }) + await waitForOtherPromisesToFinish() expect(onNoteCreatedCallback).toBeCalled() expect(view.container).toMatchSnapshot() }) @@ -113,6 +116,7 @@ describe('create non existing note hint', () => { await waitFor(async () => { expect(await screen.findByTestId('failedMessage')).toBeInTheDocument() }) + await waitForOtherPromisesToFinish() expect(onNoteCreatedCallback).not.toBeCalled() expect(view.container).toMatchSnapshot() })