mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 01:18:05 +08:00
- Introduced new test files for ChunkLabel, ChunkContainer, QAPreview, DatasetsLoading, NoLinkedAppsPanel, ApiIndex, and several document-related components. - Enhanced test coverage by validating rendering, user interactions, and edge cases for each component. - Ensured proper functionality of user interactions, such as rendering conditions and state management, improving the reliability and maintainability of dataset-related features.
25 lines
679 B
TypeScript
25 lines
679 B
TypeScript
import { cleanup, render, screen } from '@testing-library/react'
|
|
import { afterEach, describe, expect, it } from 'vitest'
|
|
import ApiIndex from '../index'
|
|
|
|
afterEach(() => {
|
|
cleanup()
|
|
})
|
|
|
|
describe('ApiIndex', () => {
|
|
it('should render without crashing', () => {
|
|
render(<ApiIndex />)
|
|
expect(screen.getByText('index')).toBeInTheDocument()
|
|
})
|
|
|
|
it('should render a div with text "index"', () => {
|
|
const { container } = render(<ApiIndex />)
|
|
expect(container.firstChild).toBeInstanceOf(HTMLDivElement)
|
|
expect(container.textContent).toBe('index')
|
|
})
|
|
|
|
it('should be a valid function component', () => {
|
|
expect(typeof ApiIndex).toBe('function')
|
|
})
|
|
})
|