Skip to content

Commit 2be3fb3

Browse files
committed
fix(tests): handle the refused provider expansion before awaiting the concurrent grant
The concurrent-grant test started ensureWorkspaceAccountsGroup and awaited the grant transaction before attaching a handler to the refusal. When the refusal resolved first, Node reported an unhandled rejection and Vitest failed the shard although the test passed. Attach the rejection assertion when the call starts and await it after the grant commits.
1 parent 3810acc commit 2be3fb3

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

‎apps/sim/lib/knowledge/__integration__/search-source-setup.integration.ts‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -492,14 +492,17 @@ describe('Search source identity and concurrent creation', () => {
492492
.where(eq(resourcePolicy.resourceId, searchGroupId))
493493
})
494494
await locked
495-
const append = ensureWorkspaceAccountsGroup(ids.workspaceId, ids.aliceId, {
496-
provider: 'jira',
497-
label: 'Jira',
498-
required: false,
499-
})
495+
/** Handled from the start: the refusal can land before the grant's commit resolves here. */
496+
const refused = expect(
497+
ensureWorkspaceAccountsGroup(ids.workspaceId, ids.aliceId, {
498+
provider: 'jira',
499+
label: 'Jira',
500+
required: false,
501+
})
502+
).rejects.toThrow('has workflow access')
500503
releaseGrant()
501504
await grant
502-
await expect(append).rejects.toThrow('has workflow access')
505+
await refused
503506
const existing = await ensureWorkspaceAccountsGroup(ids.workspaceId, ids.aliceId, {
504507
provider: 'google-drive',
505508
label: 'Google Drive',

0 commit comments

Comments
 (0)