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:
Tilman Vatteroth 2023-02-05 17:45:16 +01:00
parent 96b08615e6
commit d76714f2a2
5 changed files with 3 additions and 14 deletions

View file

@ -17,7 +17,6 @@ import { RealtimeNoteService } from './realtime-note.service';
import { mockAwareness } from './test-utils/mock-awareness'; import { mockAwareness } from './test-utils/mock-awareness';
import { mockRealtimeNote } from './test-utils/mock-realtime-note'; import { mockRealtimeNote } from './test-utils/mock-realtime-note';
import { mockWebsocketDoc } from './test-utils/mock-websocket-doc'; import { mockWebsocketDoc } from './test-utils/mock-websocket-doc';
import { waitForOtherPromisesToFinish } from './test-utils/wait-for-other-promises-to-finish';
import { WebsocketDoc } from './websocket-doc'; import { WebsocketDoc } from './websocket-doc';
describe('RealtimeNoteService', () => { describe('RealtimeNoteService', () => {

View file

@ -1,12 +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.
*/
export async function waitForOtherPromisesToFinish(): Promise<void> {
return await new Promise((resolve) => process.nextTick(resolve));
}

View file

@ -25,3 +25,5 @@ export { encodeServerVersionUpdatedMessage } from './messages/server-version-upd
export { WebsocketTransporter } from './websocket-transporter.js' export { WebsocketTransporter } from './websocket-transporter.js'
export type { MessageTransporterEvents } from './y-doc-message-transporter.js' export type { MessageTransporterEvents } from './y-doc-message-transporter.js'
export { waitForOtherPromisesToFinish } from './utils/wait-for-other-promises-to-finish.js'

View file

@ -6,9 +6,9 @@
import * as createNoteWithPrimaryAliasModule from '../../../api/notes' import * as createNoteWithPrimaryAliasModule from '../../../api/notes'
import type { Note, NoteMetadata } from '../../../api/notes/types' import type { Note, NoteMetadata } from '../../../api/notes/types'
import * as useSingleStringUrlParameterModule from '../../../hooks/common/use-single-string-url-parameter' 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 { mockI18n } from '../../markdown-renderer/test-utils/mock-i18n'
import { CreateNonExistingNoteHint } from './create-non-existing-note-hint' import { CreateNonExistingNoteHint } from './create-non-existing-note-hint'
import { waitForOtherPromisesToFinish } from '@hedgedoc/commons'
import { act, render, screen, waitFor } from '@testing-library/react' import { act, render, screen, waitFor } from '@testing-library/react'
import { Mock } from 'ts-mockery' import { Mock } from 'ts-mockery'