Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

804 B
Raw Blame
import { render, screen, waitFor } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import OperationMenu from '../operation-menu'

it.each(['edit', 'remove'])('dispatches only %s and closes the menu', async (action) => {
  const user = userEvent.setup()
  const onEdit = vi.fn()
  const onRemove = vi.fn()
  render(<OperationMenu onEdit={onEdit} onRemove={onRemove} />)
  await user.click(screen.getByRole('button', { name: 'common.operation.more' }))
  await user.click(screen.getByRole('menuitem', { name: `tools.mcp.operation.${action}` }))
  expect(action === 'edit' ? onEdit : onRemove).toHaveBeenCalledOnce()
  expect(action === 'edit' ? onRemove : onEdit).not.toHaveBeenCalled()
  await waitFor(() => expect(screen.queryByRole('menu')).not.toBeInTheDocument())
})