diff --git a/src/components/__tests__/Bullet.ts b/src/components/__tests__/Bullet.ts index 89b579170b..1fa4b3f007 100644 --- a/src/components/__tests__/Bullet.ts +++ b/src/components/__tests__/Bullet.ts @@ -26,7 +26,7 @@ describe('render', () => { }), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const bullets = document.querySelectorAll('[aria-label="bullet"]') expect(bullets.length).toBe(3) @@ -43,7 +43,7 @@ describe('render', () => { }), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) // =bullet is hidden so only a is shown // a should not have a bullet @@ -65,7 +65,7 @@ describe('render', () => { }), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) // =bullet is hidden so only a, b, c are shown // only a should have a bullet @@ -88,7 +88,7 @@ describe('render', () => { toggleHiddenThoughts(), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) // =children should not have a bullet since =bullet/None is applied const bullets = document.querySelectorAll('[aria-label="bullet"]') @@ -112,7 +112,7 @@ describe('render', () => { }), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) // only a and b should have bullets const bullets = document.querySelectorAll('[aria-label="bullet"]') @@ -133,7 +133,7 @@ describe('render', () => { toggleHiddenThoughts(), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const bullets = document.querySelectorAll('[aria-label="bullet"]') expect(bullets.length).toBe(4) @@ -150,7 +150,7 @@ describe('render', () => { toggleHiddenThoughts(), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const bullets = document.querySelectorAll('[data-bullet="parent"]') expect(bullets.length).toBe(1) @@ -171,14 +171,14 @@ describe('expansion', () => { setCursor(['a', 'b']), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const bulletOfThoughtB = getBulletByContext(['a', 'b']) const user = userEvent.setup({ delay: null }) await user.click(bulletOfThoughtB) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const thoughtCursor = await findCursor() expect(thoughtCursor).toHaveTextContent('a') @@ -198,14 +198,14 @@ describe('expansion', () => { setCursor(['x', 'a', 'b', 'c']), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const bulletOfThoughtA = getBulletByContext(['x', 'a']) const user = userEvent.setup({ delay: null }) await user.click(bulletOfThoughtA) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const thoughtCursor = await findCursor() expect(thoughtCursor).toHaveTextContent('x') @@ -224,14 +224,14 @@ describe('expansion', () => { setCursor(['a', 'b', 'c']), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const bulletOfThoughtA = getBulletByContext(['a']) const user = userEvent.setup({ delay: null }) await user.click(bulletOfThoughtA) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const thoughtCursor = await findCursor() expect(thoughtCursor).toBeNull() @@ -249,14 +249,14 @@ describe('expansion', () => { }), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const bulletOfThoughtB = getBulletByContext(['a', 'b']) const user = userEvent.setup({ delay: null }) await user.click(bulletOfThoughtB) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const thoughtCursor = await findCursor() expect(thoughtCursor).toHaveTextContent('b') @@ -277,14 +277,14 @@ describe('expansion', () => { }), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const bulletOfThoughtB = getBulletByContext(['a', 'b']) const user = userEvent.setup({ delay: null }) await user.click(bulletOfThoughtB) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const exported = exportContext(store.getState(), [HOME_TOKEN], 'text/plain') expect(exported).toEqual(`- __ROOT__ diff --git a/src/components/__tests__/ColorPicker.ts b/src/components/__tests__/ColorPicker.ts index 2a541e3d3b..a3fa093822 100644 --- a/src/components/__tests__/ColorPicker.ts +++ b/src/components/__tests__/ColorPicker.ts @@ -18,7 +18,7 @@ it('Set the bullet color using the ColorPicker', async () => { await click('[data-testid="toolbar-icon"][aria-label="Text Color"]') await click('[aria-label="text color swatches"] [aria-label="blue"]') - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const state = store.getState() @@ -47,7 +47,7 @@ it('Set the bullet color from another color using the ColorPicker', async () => await click('[data-testid="toolbar-icon"][aria-label="Text Color"]') await click('[aria-label="text color swatches"] [aria-label="red"]') - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const exported = exportContext(store.getState(), [HOME_TOKEN], 'text/plain') expect(exported).toEqual(`- __ROOT__ diff --git a/src/components/__tests__/Content.ts b/src/components/__tests__/Content.ts index 1de0564450..ea14b56a92 100644 --- a/src/components/__tests__/Content.ts +++ b/src/components/__tests__/Content.ts @@ -21,7 +21,7 @@ it('do not render EmptyThoughtspace when there are thoughts in the root context' }), ) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) expect(document.querySelector('[aria-label="empty-thoughtspace"]')).toBeNull() }) @@ -35,7 +35,7 @@ it('render EmptyThoughtspace when there are only invisible thoughts in the root }), ) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) expect(document.querySelector('[aria-label="empty-thoughtspace"]')).toBeTruthy() }) diff --git a/src/components/__tests__/ContextView.ts b/src/components/__tests__/ContextView.ts index 36deda3369..c42e92f016 100644 --- a/src/components/__tests__/ContextView.ts +++ b/src/components/__tests__/ContextView.ts @@ -38,7 +38,7 @@ it('Clicking a context moves the cursor to that context', async () => { toggleContextView(), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) // select each context in the context view const contextBreadcrumbs = document.querySelectorAll('[aria-label="context-breadcrumbs"]') @@ -56,7 +56,7 @@ it('Clicking a context moves the cursor to that context', async () => { const user = userEvent.setup({ delay: null }) await user.click(contextLink) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) // cursor should exist const cursor = store.getState().cursor! diff --git a/src/components/__tests__/LetterCasePicker.ts b/src/components/__tests__/LetterCasePicker.ts index fefdf0929e..37af64cdf6 100644 --- a/src/components/__tests__/LetterCasePicker.ts +++ b/src/components/__tests__/LetterCasePicker.ts @@ -15,7 +15,7 @@ it('Set Lower Case to the current thought', async () => { await click('[data-testid="toolbar-icon"][aria-label="LetterCase"]') await click('[aria-label="letter case swatches"] [aria-label="LowerCase"]') - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const state = store.getState() @@ -29,7 +29,7 @@ it('Set Upper Case to the current thought', async () => { await click('[data-testid="toolbar-icon"][aria-label="LetterCase"]') await click('[aria-label="letter case swatches"] [aria-label="UpperCase"]') - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const state = store.getState() @@ -43,7 +43,7 @@ it('Set Sentence Case to the current thought', async () => { await click('[data-testid="toolbar-icon"][aria-label="LetterCase"]') await click('[aria-label="letter case swatches"] [aria-label="SentenceCase"]') - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const state = store.getState() @@ -57,7 +57,7 @@ it('Set Title Case to the current thought', async () => { await click('[data-testid="toolbar-icon"][aria-label="LetterCase"]') await click('[aria-label="letter case swatches"] [aria-label="TitleCase"]') - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const state = store.getState() diff --git a/src/components/__tests__/NavBar.ts b/src/components/__tests__/NavBar.ts index ed3ac794b4..4f2408b55a 100644 --- a/src/components/__tests__/NavBar.ts +++ b/src/components/__tests__/NavBar.ts @@ -15,7 +15,7 @@ it('Strip formatting from thought values in ContextBreadcrumbs', async () => { }), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const contextBreadcrumbs = document.querySelector('[aria-label="context-breadcrumbs"]')! expect(contextBreadcrumbs.textContent).toBe('test') diff --git a/src/components/__tests__/Note.ts b/src/components/__tests__/Note.ts index 5abbe7e089..fd29f7fc21 100644 --- a/src/components/__tests__/Note.ts +++ b/src/components/__tests__/Note.ts @@ -22,7 +22,7 @@ it('basic note', async () => { setCursor(null), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const element = screen.getByText('foo') expect(element) @@ -49,7 +49,7 @@ it('re-render note when =note subthought value changes', async () => { setCursor(null), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const element = screen.getByText('bar') expect(element) @@ -76,7 +76,7 @@ it('render note when subthought is edited from non-attribute', async () => { setCursor(null), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const element = screen.getByText('foo') expect(element) @@ -103,7 +103,7 @@ it('render note when subthought is edited from non-note attribute', async () => setCursor(null), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const element = screen.getByText('foo') expect(element) diff --git a/src/components/__tests__/Superscript.ts b/src/components/__tests__/Superscript.ts index fd784292bb..4a1c29d59e 100644 --- a/src/components/__tests__/Superscript.ts +++ b/src/components/__tests__/Superscript.ts @@ -24,7 +24,7 @@ it('Superscript should count all the contexts in which it is defined.', async () }), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const element = screen.getByText('3') expect(element.nodeName).toBe('SUP') @@ -41,7 +41,7 @@ it('Superscript should not render on thoughts in a single context', async () => }), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) expect(() => screen.getByText('1')).toThrow('Unable to find an element') }) @@ -58,7 +58,7 @@ it('Superscript should not render on empty thoughts', async () => { }), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) expect(() => screen.getByText('2')).toThrow('Unable to find an element') }) @@ -72,7 +72,7 @@ it('Superscript should not render on thoughts that match EM descendants', async }), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) expect(() => screen.getByRole('superscript')).toThrow('Unable to find an accessible element') }) @@ -108,7 +108,7 @@ it('Superscript should not render on punctuation-only thoughts', async () => { }), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) expect(() => screen.getByText('2')).toThrow('Unable to find an element') expect(() => screen.getByText('3')).toThrow('Unable to find an element') @@ -128,7 +128,7 @@ it('Superscript should not render on punctuation-only thoughts with HTML', async }), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) expect(() => screen.getByText('2')).toThrow('Unable to find an element') }) @@ -145,7 +145,7 @@ it('Superscript should not count for hashed version of metaprogramming attribute toggleHiddenThoughtsActionCreator(), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) expect(() => screen.getByText('2')).toThrow('Unable to find an element') }) diff --git a/src/components/__tests__/headings.ts b/src/components/__tests__/headings.ts index 4f35bdc02c..cdff5c56a7 100644 --- a/src/components/__tests__/headings.ts +++ b/src/components/__tests__/headings.ts @@ -27,7 +27,7 @@ it('headings should set font weight', async () => { }), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) // normal text should not be bold const thought0 = await findThoughtByText('Normal Text') @@ -52,7 +52,7 @@ it('headings should set font weight', async () => { // child should not be bold store.dispatch(setCursor(['My Heading 1', '=heading1'])) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const thought1Child = await findThoughtByText('=heading1') expect(thought1Child).not.toHaveStyle({ fontWeight: 700 }) diff --git a/src/components/__tests__/style.ts b/src/components/__tests__/style.ts index 9de391d2e3..1bcbba0ed5 100644 --- a/src/components/__tests__/style.ts +++ b/src/components/__tests__/style.ts @@ -21,7 +21,7 @@ it('apply =style attribute to a thought', async () => { }), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const thoughtRazzle = (await findThoughtByText('Razzle'))?.closest('[aria-label="child"]') expect(thoughtRazzle).toHaveStyle({ color: 'rgba(255, 192, 203, 1)' }) @@ -48,7 +48,7 @@ it('apply =children/=style to all children', async () => { }), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) // do not apply to thought itself expect(await findThoughtByText('a')).not.toHaveStyle({ color: 'rgba(255, 192, 203, 1)' }) @@ -100,7 +100,7 @@ it('apply =grandchildren/=style to all grandchildren', async () => { }), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) // do not apply to thought itself expect(await findThoughtByText('a')).not.toHaveStyle({ color: 'rgba(255, 192, 203, 1)' }) @@ -131,7 +131,7 @@ it('as an exception, do not apply =grandchildren/=style to =grandchildren itself toggleHiddenThoughts(), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) expect(await findThoughtByText('=grandchildren')).not.toHaveStyle({ color: 'rgba(255, 192, 203, 1)' }) }) diff --git a/src/redux-middleware/__tests__/pullQueue.ts b/src/redux-middleware/__tests__/pullQueue.ts index c5b5dcc1b3..499c980745 100644 --- a/src/redux-middleware/__tests__/pullQueue.ts +++ b/src/redux-middleware/__tests__/pullQueue.ts @@ -46,7 +46,7 @@ it('load thought', async () => { // create a thought, which will get persisted to local db await dispatch(newThought({ value: 'a' })) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const thoughtA = contextToThought(store.getState(), ['a'])! @@ -85,7 +85,7 @@ it('do not repopulate deleted thought', async () => { setCursor(null), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const root = contextToThought(store.getState(), [HOME_TOKEN]) expect(root).toMatchObject({ @@ -109,7 +109,7 @@ it('load buffered thoughts', async () => { }), ) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const thoughtA = contextToThought(store.getState(), ['a'])! const thoughtB = contextToThought(store.getState(), ['a', 'b'])! @@ -154,7 +154,7 @@ it.skip('delete thought with buffered descendants', async () => { setCursor(['x']), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) await matchContextsChildren(db, [HOME_TOKEN], [{ value: 'x' }, { value: 'a' }]) await matchContextsChildren(db, ['a'], [{ value: 'b' }]) @@ -194,7 +194,7 @@ it('move thought with buffered descendants', async () => { setCursor(['x']), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) const thoughtX = contextToThought(store.getState(), ['x'])! const thoughtA = contextToThought(store.getState(), ['a'])! @@ -227,7 +227,7 @@ it('move thought with buffered descendants', async () => { }), ) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) await matchContextsChildren(db, [HOME_TOKEN], [{ value: 'x' }]) expect(await getContext(db, ['a'])).toBeFalsy() @@ -261,7 +261,7 @@ it.skip('edit thought with buffered descendants', async () => { setCursor(['x']), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) await matchContextsChildren(db, [HOME_TOKEN], [{ value: 'x' }, { value: 'a' }]) await matchContextsChildren(db, ['a'], [{ value: 'm' }, { value: 'b' }]) @@ -271,14 +271,14 @@ it.skip('edit thought with buffered descendants', async () => { await matchContextsChildren(db, ['a', 'b', 'c', 'd'], [{ value: 'e' }]) await matchContextsChildren(db, ['a', 'b', 'c', 'd', 'e'], []) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) await refreshTestApp() // edit thought with buffered descendants await dispatch(editThought(['a'], 'k')) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) await matchContextsChildren(db, [HOME_TOKEN], [{ value: 'x' }, { value: 'k' }]) expect(await getContext(db, ['a'])).toBeFalsy() diff --git a/src/redux-middleware/__tests__/updateUrlHistory.ts b/src/redux-middleware/__tests__/updateUrlHistory.ts index e5c5d223ad..f82941c759 100644 --- a/src/redux-middleware/__tests__/updateUrlHistory.ts +++ b/src/redux-middleware/__tests__/updateUrlHistory.ts @@ -40,7 +40,7 @@ it('set url to home after deleting last empty thought', async () => { expect(window.location.pathname).toBe(`/~/${thoughtA.id}`) await dispatch(deleteThoughtWithCursor({})) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) expect(window.location.pathname).toBe('/') }) diff --git a/src/shortcuts/__tests__/bumpThoughtDown.ts b/src/shortcuts/__tests__/bumpThoughtDown.ts index 60c73ef329..b799e13da5 100644 --- a/src/shortcuts/__tests__/bumpThoughtDown.ts +++ b/src/shortcuts/__tests__/bumpThoughtDown.ts @@ -19,7 +19,7 @@ it('reset content editable inner html on bumpThoughtDown', async () => { setCursor(['a']), ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) expect(document.querySelector(`div[data-editable]`)?.textContent).toBe('a') @@ -27,7 +27,7 @@ it('reset content editable inner html on bumpThoughtDown', async () => { executeShortcut(bumpThoughtDown) }) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) expect(document.querySelector(`div[data-editable]`)?.textContent).toBe('') }) diff --git a/src/shortcuts/__tests__/delete.ts b/src/shortcuts/__tests__/delete.ts index 16adf8b303..d95d00a767 100644 --- a/src/shortcuts/__tests__/delete.ts +++ b/src/shortcuts/__tests__/delete.ts @@ -29,11 +29,11 @@ describe('delete', () => { ]) }) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) act(() => executeShortcut(deleteShortcut, { store })) - await act(async () => vi.runAllTimersAsync()) + await act(vi.runAllTimersAsync) const popupValue = await screen.findByTestId('popup-value')! expect(popupValue.textContent).toBe('Permanently deleted test') diff --git a/src/shortcuts/__tests__/deleteEmptyThoughtOrOutdent.ts b/src/shortcuts/__tests__/deleteEmptyThoughtOrOutdent.ts index 993328086a..95606ca81a 100644 --- a/src/shortcuts/__tests__/deleteEmptyThoughtOrOutdent.ts +++ b/src/shortcuts/__tests__/deleteEmptyThoughtOrOutdent.ts @@ -31,7 +31,7 @@ describe('DOM', () => { ]) }) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) // This ensures that the thought b exists so we can confirm later that it is deleted. const initialExportedData = exportContext(store.getState(), [HOME_TOKEN], 'text/plain') @@ -44,7 +44,7 @@ describe('DOM', () => { executeShortcut(deleteEmptyThoughtOrOutdent) }) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) // This ensures that the thought b doesn't exist now. const exported = exportContext(store.getState(), [HOME_TOKEN], 'text/plain') diff --git a/src/shortcuts/__tests__/deleteThought.ts b/src/shortcuts/__tests__/deleteThought.ts index 25eccd592e..d01d835ac0 100644 --- a/src/shortcuts/__tests__/deleteThought.ts +++ b/src/shortcuts/__tests__/deleteThought.ts @@ -26,7 +26,7 @@ describe('mount', () => { store.dispatch([{ type: 'newThought', value: 'apple' }, { type: 'newThought' }, { type: 'deleteEmptyThought' }]) }) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) // Selection.focusOffset a number representing the offset of the selection's anchor within the focusNode. If focusNode is a text node, this is the number of characters within focusNode preceding the focus. If focusNode is an element, this is the number of chi,ld nodes of the focusNode preceding the focus. // In this case, the selection is at the end of the apple element. @@ -48,7 +48,7 @@ describe('mount', () => { ]) }) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) // Selection.focusOffset a number representing the offset of the selection's anchor within the focusNode. If focusNode is a text node, this is the number of characters within focusNode preceding the focus. If focusNode is an element, this is the number of chi,ld nodes of the focusNode preceding the focus. // In this case, the selection is in the applebanana text node, in between apple and banana. diff --git a/src/shortcuts/__tests__/splitThought.ts b/src/shortcuts/__tests__/splitThought.ts index a7f4b5e0cb..e01266ca97 100644 --- a/src/shortcuts/__tests__/splitThought.ts +++ b/src/shortcuts/__tests__/splitThought.ts @@ -21,7 +21,7 @@ it('split thought after non-word character', async () => { }, ]) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) // ensure that the Lexeme is not duplicated since it is the same as the source thought expect(() => screen.getByText('2')).toThrow('Unable to find an element') diff --git a/src/shortcuts/__tests__/toggleSort.ts b/src/shortcuts/__tests__/toggleSort.ts index 9f8b6c8c06..0f3bfcbb76 100644 --- a/src/shortcuts/__tests__/toggleSort.ts +++ b/src/shortcuts/__tests__/toggleSort.ts @@ -48,7 +48,7 @@ describe('DOM', () => { ]) }) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) act(() => executeShortcut(toggleSortShortcut, { store })) diff --git a/src/test-helpers/createTestApp.tsx b/src/test-helpers/createTestApp.tsx index f64dc45120..456592d7e1 100644 --- a/src/test-helpers/createTestApp.tsx +++ b/src/test-helpers/createTestApp.tsx @@ -77,7 +77,7 @@ export const refreshTestApp = async () => { await initialize() }) - await act(async () => vi.runOnlyPendingTimersAsync()) + await act(vi.runOnlyPendingTimersAsync) } export default createTestApp