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:
Tilman Vatteroth 2022-12-24 14:36:05 +01:00
parent e5359a69ca
commit 9c3858797f
6 changed files with 11 additions and 11 deletions

View file

@ -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')

View file

@ -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()

View file

@ -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 () => {

View file

@ -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')

View file

@ -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)

View file

@ -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()