mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-01-23 04:52:15 +00:00
fix(frontend): Add generic type to act calls to trigger promise generation
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
e5359a69ca
commit
9c3858797f
6 changed files with 11 additions and 11 deletions
|
@ -39,7 +39,7 @@ describe('Copy to clipboard button', () => {
|
|||
const view = render(copyToClipboardButton)
|
||||
expect(view.container).toMatchSnapshot()
|
||||
const button = await screen.findByTitle('renderer.highlightCode.copyCode')
|
||||
await act(() => {
|
||||
await act<void>(() => {
|
||||
button.click()
|
||||
})
|
||||
const tooltip = await screen.findByRole('tooltip')
|
||||
|
|
|
@ -60,7 +60,7 @@ describe('motd modal', () => {
|
|||
expect(view.container).toMatchSnapshot()
|
||||
|
||||
const button = await screen.findByTestId('motd-dismiss')
|
||||
await act(() => {
|
||||
await act<void>(() => {
|
||||
button.click()
|
||||
})
|
||||
expect(view.container).toMatchSnapshot()
|
||||
|
|
|
@ -77,7 +77,7 @@ describe('create non existing note hint', () => {
|
|||
const onNoteCreatedCallback = jest.fn()
|
||||
const view = render(<CreateNonExistingNoteHint onNoteCreated={onNoteCreatedCallback}></CreateNonExistingNoteHint>)
|
||||
const button = await screen.findByTestId('createNoteButton')
|
||||
await act(() => {
|
||||
await act<void>(() => {
|
||||
button.click()
|
||||
})
|
||||
await waitFor(async () => {
|
||||
|
@ -92,7 +92,7 @@ describe('create non existing note hint', () => {
|
|||
const onNoteCreatedCallback = jest.fn()
|
||||
const view = render(<CreateNonExistingNoteHint onNoteCreated={onNoteCreatedCallback}></CreateNonExistingNoteHint>)
|
||||
const button = await screen.findByTestId('createNoteButton')
|
||||
await act(() => {
|
||||
await act<void>(() => {
|
||||
button.click()
|
||||
})
|
||||
await waitFor(async () => {
|
||||
|
@ -107,7 +107,7 @@ describe('create non existing note hint', () => {
|
|||
const onNoteCreatedCallback = jest.fn()
|
||||
const view = render(<CreateNonExistingNoteHint onNoteCreated={onNoteCreatedCallback}></CreateNonExistingNoteHint>)
|
||||
const button = await screen.findByTestId('createNoteButton')
|
||||
await act(() => {
|
||||
await act<void>(() => {
|
||||
button.click()
|
||||
})
|
||||
await waitFor(async () => {
|
||||
|
|
|
@ -46,7 +46,7 @@ describe('AliasesAddForm', () => {
|
|||
const input = await screen.findByTestId('addAliasInput')
|
||||
await testEvent.type(input, 'abc')
|
||||
expect(button).toBeEnabled()
|
||||
await act(() => {
|
||||
await act<void>(() => {
|
||||
button.click()
|
||||
})
|
||||
expect(AliasModule.addAlias).toBeCalledWith('mock-note', 'abc')
|
||||
|
|
|
@ -46,7 +46,7 @@ describe('AliasesListEntry', () => {
|
|||
const view = render(<AliasesListEntry alias={testAlias} />)
|
||||
expect(view.container).toMatchSnapshot()
|
||||
const button = await screen.findByTestId('aliasButtonRemove')
|
||||
await act(() => {
|
||||
await act<void>(() => {
|
||||
button.click()
|
||||
})
|
||||
expect(AliasModule.deleteAlias).toBeCalledWith(testAlias.name)
|
||||
|
@ -63,14 +63,14 @@ describe('AliasesListEntry', () => {
|
|||
const view = render(<AliasesListEntry alias={testAlias} />)
|
||||
expect(view.container).toMatchSnapshot()
|
||||
const buttonRemove = await screen.findByTestId('aliasButtonRemove')
|
||||
await act(() => {
|
||||
await act<void>(() => {
|
||||
buttonRemove.click()
|
||||
})
|
||||
expect(AliasModule.deleteAlias).toBeCalledWith(testAlias.name)
|
||||
await deletePromise
|
||||
expect(NoteDetailsReduxModule.updateMetadata).toBeCalled()
|
||||
const buttonMakePrimary = await screen.findByTestId('aliasButtonMakePrimary')
|
||||
await act(() => {
|
||||
await act<void>(() => {
|
||||
buttonMakePrimary.click()
|
||||
})
|
||||
expect(AliasModule.markAliasAsPrimary).toBeCalledWith(testAlias.name)
|
||||
|
|
|
@ -17,7 +17,7 @@ describe('Settings On-Off Button Group', () => {
|
|||
const view = render(<OnOffButtonGroup value={value} onSelect={onSelect} />)
|
||||
expect(view.container).toMatchSnapshot()
|
||||
const onButton = await screen.findByTestId('onOffButtonGroupOn')
|
||||
await act(() => {
|
||||
await act<void>(() => {
|
||||
onButton.click()
|
||||
})
|
||||
expect(value).toBeTruthy()
|
||||
|
@ -25,7 +25,7 @@ describe('Settings On-Off Button Group', () => {
|
|||
view.rerender(<OnOffButtonGroup value={value} onSelect={onSelect} />)
|
||||
expect(view.container).toMatchSnapshot()
|
||||
const offButton = await screen.findByTestId('onOffButtonGroupOff')
|
||||
await act(() => {
|
||||
await act<void>(() => {
|
||||
offButton.click()
|
||||
})
|
||||
expect(value).toBeFalsy()
|
||||
|
|
Loading…
Reference in a new issue