mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 09:58:04 +08:00
test: add unit tests for base components (#32818)
Co-authored-by: CodingOnStar <hanxujiang@dify.com>
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import * as React from 'react'
|
||||
import { createReactI18nextMock } from '@/test/i18n-mock'
|
||||
import Input, { inputVariants } from './index'
|
||||
import Input, { inputVariants } from '../index'
|
||||
|
||||
// Mock the i18n hook with custom translations for test assertions
|
||||
vi.mock('react-i18next', () => createReactI18nextMock({
|
||||
@ -103,7 +103,7 @@ describe('Input component', () => {
|
||||
})
|
||||
|
||||
it('applies large size variant correctly', () => {
|
||||
render(<Input size={'large' as any} />)
|
||||
render(<Input size="large" />)
|
||||
const input = screen.getByPlaceholderText('Please input')
|
||||
expect(input.className).toContain(inputVariants({ size: 'large' }))
|
||||
})
|
||||
Reference in New Issue
Block a user