test: stable test (#32108)

This commit is contained in:
Stephen Zhou
2026-02-09 13:36:37 +08:00
committed by yyh
parent bc9ca4e0dd
commit 6f50915d2b
2 changed files with 19 additions and 7 deletions

View File

@@ -1138,17 +1138,27 @@ describe('CommonCreateModal', () => {
mockVerifyCredentials.mockImplementation((params, { onError }) => {
onError(new Error('Raw error'))
})
const builder = createMockSubscriptionBuilder()
render(<CommonCreateModal {...defaultProps} />)
await waitFor(() => {
expect(mockCreateBuilder).toHaveBeenCalled()
})
render(<CommonCreateModal {...defaultProps} builder={builder} />)
fireEvent.click(screen.getByTestId('modal-confirm'))
await waitFor(() => {
expect(mockParsePluginErrorMessage).toHaveBeenCalled()
expect(mockVerifyCredentials).toHaveBeenCalledWith(
expect.objectContaining({
provider: 'test-provider',
subscriptionBuilderId: builder.id,
}),
expect.objectContaining({
onSuccess: expect.any(Function),
onError: expect.any(Function),
}),
)
})
await waitFor(() => {
expect(mockParsePluginErrorMessage).toHaveBeenCalledWith(expect.any(Error))
})
})

View File

@@ -774,7 +774,9 @@ describe('WorkflowToolConfigureButton', () => {
})
// Component should still render without crashing
expect(screen.getByText('workflow.common.workflowAsTool')).toBeInTheDocument()
await waitFor(() => {
expect(screen.getByText('workflow.common.workflowAsTool')).toBeInTheDocument()
})
})
it('should handle rapid publish/unpublish state changes', async () => {