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.

844 B
Raw Blame
import { render, screen } from '@testing-library/react'
import { CodeBlock } from '../code-block'

vi.mock('echarts-for-react', () => {
  throw new Error('Chart chunk unavailable')
})
vi.mock('../music', () => {
  throw new Error('Music chunk unavailable')
})

vi.mock('../../svg-gallery', () => {
  throw new Error('SVG chunk unavailable')
})

it.each([
  ['svg', '<svg/>'],
  ['echarts', '{"series":[]}'],
  ['abc', 'X:1\nK:C\nC D E F|'],
])('contains a failed %s chunk within the code-block error boundary', async (language, content) => {
  const consoleError = vi.spyOn(console, 'error').mockImplementation(() => {})
  try {
    render(<CodeBlock className={`language-${language}`}>{content}</CodeBlock>)
    expect(await screen.findByText(/Oops! An error occurred/)).toBeInTheDocument()
  } finally {
    consoleError.mockRestore()
  }
})