import { fireEvent, render, screen, waitFor, within } from "@testing-library/react";
import { afterEach, beforeAll, describe, expect, it, vi } from "vitest";
import { CustomerForm } from "./customer-form";
const {
createMock,
findCustomerDuplicatesMock,
getAllCompaniesMock,
} = vi.hoisted(() => ({
createMock: vi.fn(),
findCustomerDuplicatesMock: vi.fn(),
getAllCompaniesMock: vi.fn(),
}));
vi.mock("@/lib/pocketbase", () => ({
__esModule: true,
default: () => ({
collection: () => ({
create: createMock,
update: vi.fn(),
}),
}),
}));
vi.mock("sonner", () => ({
toast: { error: vi.fn(), success: vi.fn() },
}));
vi.mock("@/lib/pb-helpers", () => ({
getAllCompanies: getAllCompaniesMock,
findCustomerDuplicates: findCustomerDuplicatesMock,
}));
vi.mock("@/components/ui/company-search", () => ({
CompanySearch: () =>
Company Search
,
}));
vi.mock("@/components/ui/user-search", () => ({
UserSearch: () => User Search
,
}));
// `CustomerForm` now fetches `/api/v1/customers/sites` (added 2026-09
// for the `site_location` `