Skip to content

Commit 124f4ba

Browse files
authored
fix(search): wait for the source-created handler in the live setup test (#8227)
The live service-source test asserted updateSearchIntegration immediately after the create onSuccess act, but onCreated awaits the nuqs URL-state reset (which flushes asynchronously) before it starts the mutation, so the assertion raced the flush and failed most runs. Wait for it the same way the sibling setup test already does (vi.waitFor with a 1ms interval).
1 parent 05ed98d commit 124f4ba

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

‎apps/sim/app/o/[organizationId]/settings/components/integrations/search-source-setup.test.tsx‎

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -604,17 +604,21 @@ describe('organization setup entry points', () => {
604604
connector({ id: 'new-gmail', connectorType: 'gmail', accessMode: 'admin' })
605605
)
606606
)
607-
expect(mocks.updateSearchIntegration).toHaveBeenCalledWith(
608-
{
609-
organizationId: 'org-1',
610-
connectorType: 'gmail',
611-
approved: true,
612-
policy: expect.objectContaining({
613-
accessMode: 'service_account',
614-
sourceId: 'new-gmail',
615-
}),
616-
},
617-
expect.any(Object)
607+
await vi.waitFor(
608+
() =>
609+
expect(mocks.updateSearchIntegration).toHaveBeenCalledWith(
610+
{
611+
organizationId: 'org-1',
612+
connectorType: 'gmail',
613+
approved: true,
614+
policy: expect.objectContaining({
615+
accessMode: 'service_account',
616+
sourceId: 'new-gmail',
617+
}),
618+
},
619+
expect.any(Object)
620+
),
621+
{ interval: 1 }
618622
)
619623
expect(mocks.push).not.toHaveBeenCalled()
620624
await act(async () => mocks.updateSearchIntegration.mock.calls[0][1].onSuccess())

0 commit comments

Comments
 (0)