mirror of
https://github.com/langgenius/dify.git
synced 2026-02-20 18:04:48 +08:00
Some checks are pending
autofix.ci / autofix (push) Waiting to run
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/amd64, build-api-amd64) (push) Waiting to run
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/arm64, build-api-arm64) (push) Waiting to run
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/amd64, build-web-amd64) (push) Waiting to run
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/arm64, build-web-arm64) (push) Waiting to run
Build and Push API & Web / create-manifest (api, DIFY_API_IMAGE_NAME, merge-api-images) (push) Blocked by required conditions
Build and Push API & Web / create-manifest (web, DIFY_WEB_IMAGE_NAME, merge-web-images) (push) Blocked by required conditions
Main CI Pipeline / Check Changed Files (push) Waiting to run
Main CI Pipeline / API Tests (push) Blocked by required conditions
Main CI Pipeline / Web Tests (push) Blocked by required conditions
Main CI Pipeline / Style Check (push) Waiting to run
Main CI Pipeline / VDB Tests (push) Blocked by required conditions
Main CI Pipeline / DB Migration Test (push) Blocked by required conditions
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import { render, screen } from '@testing-library/react'
|
|
import * as React from 'react'
|
|
import ListEmpty from './index'
|
|
|
|
describe('ListEmpty Component', () => {
|
|
describe('Render', () => {
|
|
it('renders default icon when no icon is provided', () => {
|
|
const { container } = render(<ListEmpty />)
|
|
expect(container.querySelector('[data-icon="Variable02"]')).toBeInTheDocument()
|
|
})
|
|
|
|
it('renders custom icon when provided', () => {
|
|
const { container } = render(<ListEmpty icon={<div data-testid="custom-icon" />} />)
|
|
expect(container.querySelector('[data-icon="Variable02"]')).not.toBeInTheDocument()
|
|
expect(screen.getByTestId('custom-icon')).toBeInTheDocument()
|
|
})
|
|
|
|
it('renders design lines', () => {
|
|
const { container } = render(<ListEmpty />)
|
|
const svgs = container.querySelectorAll('svg')
|
|
expect(svgs).toHaveLength(5)
|
|
})
|
|
})
|
|
|
|
describe('Props', () => {
|
|
it('renders title and description correctly', () => {
|
|
const testTitle = 'Empty List'
|
|
const testDescription = <span data-testid="desc">No items found</span>
|
|
|
|
render(<ListEmpty title={testTitle} description={testDescription} />)
|
|
|
|
expect(screen.getByText(testTitle)).toBeInTheDocument()
|
|
expect(screen.getByTestId('desc')).toBeInTheDocument()
|
|
expect(screen.getByText('No items found')).toBeInTheDocument()
|
|
})
|
|
})
|
|
})
|