test: update unit tests to use Vitest framework

- Refactored test files for data source options, drawer, and pipeline settings to utilize Vitest for improved testing capabilities.
- Ensured consistent testing practices across components by importing necessary Vitest functions.
This commit is contained in:
CodingOnStar
2026-02-10 21:01:53 +08:00
parent 94eefaaee2
commit a9f56716fc
3 changed files with 3 additions and 4 deletions

View File

@ -1,6 +1,6 @@
import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types'
import { renderHook } from '@testing-library/react'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { useDatasourceIcon } from './hooks'
const mockTransformDataSourceToTool = vi.fn()

View File

@ -1,8 +1,7 @@
import { render, screen } from '@testing-library/react'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import Drawer from './drawer'
// Capture the useKeyPress callback so tests can invoke it
let capturedKeyPressCallback: ((e: KeyboardEvent) => void) | undefined
vi.mock('ahooks', () => ({

View File

@ -1,5 +1,5 @@
import { renderHook } from '@testing-library/react'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { useInputVariables } from './hooks'
let mockPipelineId: string | undefined