mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
refactor(web): migrate to Vitest and esm (#29974)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
This commit is contained in:
@ -2,13 +2,13 @@ import { render, screen } from '@testing-library/react'
|
||||
import { TopBar, type TopBarProps } from './index'
|
||||
|
||||
// Mock next/link to capture href values
|
||||
jest.mock('next/link', () => {
|
||||
return ({ children, href, replace, className }: { children: React.ReactNode; href: string; replace?: boolean; className?: string }) => (
|
||||
vi.mock('next/link', () => ({
|
||||
default: ({ children, href, replace, className }: { children: React.ReactNode; href: string; replace?: boolean; className?: string }) => (
|
||||
<a href={href} data-replace={replace} className={className} data-testid="back-link">
|
||||
{children}
|
||||
</a>
|
||||
)
|
||||
})
|
||||
),
|
||||
}))
|
||||
|
||||
// Helper to render TopBar with default props
|
||||
const renderTopBar = (props: Partial<TopBarProps> = {}) => {
|
||||
@ -27,7 +27,7 @@ const renderTopBar = (props: Partial<TopBarProps> = {}) => {
|
||||
// ============================================================================
|
||||
describe('TopBar', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks()
|
||||
vi.clearAllMocks()
|
||||
})
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user