mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 01:18:05 +08:00
Merge remote-tracking branch 'origin/main' into feat/support-agent-sandbox
# Conflicts: # web/app/components/workflow-app/hooks/__tests__/use-nodes-sync-draft.spec.ts # web/app/components/workflow-app/hooks/__tests__/use-workflow-refresh-draft.spec.ts # web/app/components/workflow-app/hooks/use-workflow-run.ts # web/app/components/workflow-app/index.tsx # web/app/components/workflow/panel/chat-variable-panel/components/use-variable-modal-state.ts # web/app/components/workflow/panel/chat-variable-panel/components/variable-modal.helpers.ts
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { fireEvent, render, screen, waitFor } from '@testing-library/react'
|
||||
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import { useState } from 'react'
|
||||
import GenericTable from '../generic-table'
|
||||
@ -50,8 +50,19 @@ const advancedColumns = [
|
||||
describe('GenericTable', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
vi.useRealTimers()
|
||||
})
|
||||
|
||||
const selectOption = async (triggerName: string, optionName: string) => {
|
||||
await act(async () => {
|
||||
fireEvent.click(screen.getByRole('button', { name: triggerName }))
|
||||
})
|
||||
|
||||
await act(async () => {
|
||||
fireEvent.click(await screen.findByRole('option', { name: optionName }))
|
||||
})
|
||||
}
|
||||
|
||||
it('should render an empty editable row and append a configured row when typing into the virtual row', async () => {
|
||||
const onChange = vi.fn()
|
||||
|
||||
@ -143,11 +154,11 @@ describe('GenericTable', () => {
|
||||
<ControlledTable />,
|
||||
)
|
||||
|
||||
await user.click(screen.getByRole('button', { name: 'Choose method' }))
|
||||
await user.click(await screen.findByRole('option', { name: 'POST' }))
|
||||
await selectOption('Choose method', 'POST')
|
||||
|
||||
await waitFor(() => {
|
||||
expect(onChange).toHaveBeenCalledWith([{ method: 'post', preview: '' }])
|
||||
expect(screen.getByRole('button', { name: 'POST' })).toBeInTheDocument()
|
||||
})
|
||||
|
||||
onChange.mockClear()
|
||||
|
||||
Reference in New Issue
Block a user