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.

1.0 KB
Raw Blame
import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { useState } from 'react'
import MCPServerParamItem from '../mcp-server-param-item'

it('edits and clears the named server parameter', async () => {
  const user = userEvent.setup()
  const onChange = vi.fn()
  const Harness = () => {
    const [value, setValue] = useState('existing')
    return (
      <MCPServerParamItem
        data={{ label: 'Instructions', variable: 'instructions', type: 'string' }}
        value={value}
        onChange={(value) => {
          setValue(value)
          onChange(value)
        }}
      />
    )
  }
  render(<Harness />)
  const input = screen.getByRole('textbox', { name: 'Instructions' })
  expect(input).toHaveValue('existing')
  await user.clear(input)
  expect(onChange).toHaveBeenLastCalledWith('')
  await user.type(input, 'Use this tool\nfor search')
  expect(onChange).toHaveBeenLastCalledWith('Use this tool\nfor search')
  expect(input).toHaveValue('Use this tool\nfor search')
})