import { createRef, StrictMode, type ReactNode } from "react"; import { act, cleanup, fireEvent, render, screen } from "@testing-library/react"; import { afterEach, describe, expect, it, vi } from "vitest"; import { TooltipProvider } from "@kandev/ui/tooltip"; import { ToastProvider } from "@/components/toast-provider"; import { MAX_FILES, MAX_FILE_SIZE, MAX_TOTAL_SIZE, processFile, } from "@/components/task/chat/file-attachment"; import { formatBytes } from "@/lib/utils/format-bytes"; import { TaskFormInputs } from "./task-create-dialog-selectors"; import type { TaskFormInputsHandle } from "./task-create-dialog-types"; const TOAST_MESSAGE_TEST_ID = "toast-message"; vi.mock("@/components/task/chat/file-attachment", async () => { const actual = await vi.importActual( "@/components/task/chat/file-attachment", ); return { ...actual, processFile: vi.fn() }; }); // Capture the props (notably `onTranscript` / `onAutoSend`) that // TaskFormInputs hands the voice button so we can drive transcripts // without instantiating the real VoiceInputButton (which subscribes to // the user-settings store and instantiates voice engines). type VoiceProps = { onTranscript: (text: string) => void; onAutoSend?: () => void; disabled?: boolean; }; const voiceCalls: VoiceProps[] = []; vi.mock("@/components/task/chat/voice-input-button", () => ({ VoiceInputButton: (props: VoiceProps) => { voiceCalls.push(props); return