test(billing): harden personal→team gate test against cold-run emit race (FE-991)

The new container gate test could fail on a cold-cache first run (onChooseTeam
observed 0 calls) due to a userEvent/happy-dom event-dispatch warm-up race; the
gate source is synchronous and correct. Wrap the positive assertions in
vi.waitFor so the emit lands deterministically.
This commit is contained in:
dante01yoon
2026-06-22 00:20:55 +09:00
parent d526bcd3dc
commit 4e609999d4

View File

@@ -97,7 +97,9 @@ describe('SubscriptionRequiredDialogContentUnified team-plan gate', () => {
await user.click(screen.getByTestId('subscribe-team-btn'))
expect(onChooseTeam).toHaveBeenCalledOnce()
await vi.waitFor(() => {
expect(onChooseTeam).toHaveBeenCalledOnce()
})
expect(mockHandleSubscribeTeamClick).not.toHaveBeenCalled()
})
@@ -109,7 +111,9 @@ describe('SubscriptionRequiredDialogContentUnified team-plan gate', () => {
await user.click(screen.getByTestId('subscribe-team-btn'))
expect(mockHandleSubscribeTeamClick).toHaveBeenCalledWith(TEAM_PAYLOAD)
await vi.waitFor(() => {
expect(mockHandleSubscribeTeamClick).toHaveBeenCalledWith(TEAM_PAYLOAD)
})
expect(onChooseTeam).not.toHaveBeenCalled()
})
})