test: add unit and integration tests for share, develop, and goto-anything modules (#32246)

Co-authored-by: CodingOnStar <hanxujiang@dify.com>
This commit is contained in:
Coding On Star
2026-02-12 10:05:43 +08:00
committed by GitHub
parent 80e6312807
commit bfdc39510b
49 changed files with 2880 additions and 555 deletions

View File

@ -1,13 +1,20 @@
import { act, render, screen, waitFor } from '@testing-library/react'
import * as React from 'react'
import CSVReader from './index'
import CSVReader from '../index'
let mockAcceptedFile: { name: string } | null = null
let capturedHandlers: Record<string, (payload: any) => void> = {}
type CSVReaderHandlers = {
onUploadAccepted?: (payload: { data: string[][] }) => void
onDragOver?: (event: DragEvent) => void
onDragLeave?: (event: DragEvent) => void
}
let capturedHandlers: CSVReaderHandlers = {}
vi.mock('react-papaparse', () => ({
useCSVReader: () => ({
CSVReader: ({ children, ...handlers }: any) => {
CSVReader: ({ children, ...handlers }: { children: (ctx: { getRootProps: () => Record<string, string>, acceptedFile: { name: string } | null }) => React.ReactNode } & CSVReaderHandlers) => {
capturedHandlers = handlers
return (
<div data-testid="csv-reader-wrapper">