// frontend/tests/connectors/ImportDropzone.test.tsx — 파일 선택 시 onImport(File) 호출
import { render, screen, fireEvent } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
import { ImportDropzone } from "@/components/connectors/ImportDropzone";

describe("ImportDropzone", () => {
  it("파일 선택 시 onImport 가 그 File 로 호출됨", () => {
    const onImport = vi.fn();
    render(<ImportDropzone onImport={onImport} />);
    const input = screen.getByLabelText("파일 가져오기") as HTMLInputElement;
    const file = new File(["a,b,c"], "tx.csv", { type: "text/csv" });
    fireEvent.change(input, { target: { files: [file] } });
    expect(onImport).toHaveBeenCalledTimes(1);
    expect(onImport).toHaveBeenCalledWith(file);
  });
});
