mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-17 00:24:43 -04:00
fix(commons): Move "wait for other promises to finish" util to commons
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
96b08615e6
commit
d76714f2a2
5 changed files with 3 additions and 14 deletions
|
@ -6,9 +6,9 @@
|
|||
import * as createNoteWithPrimaryAliasModule from '../../../api/notes'
|
||||
import type { Note, NoteMetadata } from '../../../api/notes/types'
|
||||
import * as useSingleStringUrlParameterModule from '../../../hooks/common/use-single-string-url-parameter'
|
||||
import { waitForOtherPromisesToFinish } from '../../../utils/wait-for-other-promises-to-finish'
|
||||
import { mockI18n } from '../../markdown-renderer/test-utils/mock-i18n'
|
||||
import { CreateNonExistingNoteHint } from './create-non-existing-note-hint'
|
||||
import { waitForOtherPromisesToFinish } from '@hedgedoc/commons'
|
||||
import { act, render, screen, waitFor } from '@testing-library/react'
|
||||
import { Mock } from 'ts-mockery'
|
||||
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
/**
|
||||
* Waits until all other pending promises are processed.
|
||||
*
|
||||
* NodeJS has a queue for async code that waits for being processed. This method adds a promise to the very end of this queue.
|
||||
* If the promise is resolved then this means that all other promises before it have been processed as well.
|
||||
*
|
||||
* @return A promise which resolves when all other promises have been processed
|
||||
*/
|
||||
export function waitForOtherPromisesToFinish(): Promise<void> {
|
||||
return new Promise((resolve) => process.nextTick(resolve))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue