Files
dify/web/app/components/datasets/api/index.spec.tsx
CodingOnStar 0f6befd0a2 test: add comprehensive tests for datasets components with 95%+ coverage
- Add tests for api-access/index.tsx (100% coverage)
- Enhance tests for operations.tsx (95.65% coverage)
- Enhance tests for status-item/index.tsx (93.75% coverage)
- Add tests for simple components: chunk, loading, preview, statistics, empty-folder, no-linked-apps-panel, api/index
- Remove tests for complex component retrieval-param-config
- Test operations: archive, unarchive, enable, disable, sync, pause, resume, delete, download, rename
- Test switch toggles with debounce handling
- Test error notifications and success callbacks

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 14:42:43 +08:00

25 lines
678 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')
})
})