dify/web/app/components/base/logo/__tests__/logo-site.spec.tsx
Coding On Star 335b500aea
test: add unit tests for base components (#32818)
Co-authored-by: CodingOnStar <hanxujiang@dify.com>
2026-03-02 11:40:43 +08:00

23 lines
693 B
TypeScript

import { render, screen } from '@testing-library/react'
import LogoSite from '../logo-site'
vi.mock('@/utils/var', () => ({
basePath: '/test-base-path',
}))
describe('LogoSite', () => {
it('renders correctly with default props', () => {
render(<LogoSite />)
const img = screen.getByRole('img', { name: /logo/i })
expect(img).toBeInTheDocument()
expect(img).toHaveAttribute('src', '/test-base-path/logo/logo.png')
})
it('applies custom className correctly', () => {
const customClass = 'custom-site-class'
render(<LogoSite className={customClass} />)
const img = screen.getByRole('img', { name: /logo/i })
expect(img).toHaveClass(customClass)
})
})