import { render, screen } from "@testing-library/react";
import App from "./App.jsx";

vi.mock("react-quick-pinch-zoom", () => ({
  default: ({ children }) => <div>{children}</div>
}));

vi.mock("./lib/api.js", () => ({
  getOperations: () => Promise.resolve({
    operations: [
      { id: "histeq", label: "Histogram Equalization", chapter: "Basic", slide_group: "Histogram", params: {}, matrices: [] }
    ]
  }),
  listStates: () => Promise.resolve({ states: [] }),
  uploadImage: vi.fn(),
  applyStateOperation: vi.fn(),
  combineStates: vi.fn(),
  deleteState: vi.fn()
}));

describe("App", () => {
  it("renders the workspace immediately", async () => {
    render(<App />);
    expect(screen.getByText("Image Processing Workspace")).toBeInTheDocument();
    expect(screen.getByText("Image States")).toBeInTheDocument();
    expect(await screen.findByText("Arithmetic / Logic")).toBeInTheDocument();
  });
});
