Skip to content

Commit 0ec3bda

Browse files
committed
test(sim-links): use the shared macrotask flush in the sources popover test
1 parent c51a624 commit 0ec3bda

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

‎apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/message-sources/message-sources.test.tsx‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* @vitest-environment jsdom
33
*/
44
import { act } from 'react'
5+
import { flushMacrotask } from '@sim/testing'
56
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
67
import { createRoot, type Root } from 'react-dom/client'
78
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
@@ -17,9 +18,7 @@ function press(element: Element | null) {
1718
}
1819

1920
async function settle() {
20-
await act(async () => {
21-
await new Promise((resolve) => setTimeout(resolve, 0))
22-
})
21+
await act(flushMacrotask)
2322
}
2423

2524
describe('creating a Sim link from the sources popover', () => {
@@ -49,7 +48,6 @@ describe('creating a Sim link from the sources popover', () => {
4948
afterEach(() => {
5049
act(() => root.unmount())
5150
container.remove()
52-
vi.unstubAllGlobals()
5351
})
5452

5553
it('opens the form outside the popover and dismisses the popover, so the form is never beneath it', async () => {

0 commit comments

Comments
 (0)