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:
Stephen Zhou
2025-12-22 16:35:22 +08:00
committed by GitHub
parent 42f7ecda12
commit eabdc5f0eb
268 changed files with 5455 additions and 6307 deletions

View File

@ -5,8 +5,8 @@ import { useBatchUpdateDocMetadata } from '@/service/knowledge/use-metadata'
import { useDocumentListKey } from './use-document'
// Mock the post function to avoid real network requests
jest.mock('@/service/base', () => ({
post: jest.fn().mockResolvedValue({ success: true }),
vi.mock('@/service/base', () => ({
post: vi.fn().mockResolvedValue({ success: true }),
}))
const NAME_SPACE = 'dataset-metadata'
@ -28,7 +28,7 @@ describe('useBatchUpdateDocMetadata', () => {
const { result } = renderHook(() => useBatchUpdateDocMetadata(), { wrapper })
// Spy on queryClient.invalidateQueries
const invalidateSpy = jest.spyOn(queryClient, 'invalidateQueries')
const invalidateSpy = vi.spyOn(queryClient, 'invalidateQueries')
// Correct payload type: each document has its own metadata_list array