import { render, screen } from "@testing-library/react";
import { MemoryRouter } from "react-router-dom";
import { describe, expect, it, vi } from "vitest";
import App from "../src/App";

// minimal stub so App renders without network calls
vi.mock("../src/lib/api", () => ({
  api: {
    users: { list: vi.fn().mockResolvedValue([]) },
    reports: {
      weekly: vi.fn().mockResolvedValue({
        days: [],
        weekTotalMinutes: 0,
        weekTotalCostCents: 0,
      }),
    },
    timeEntries: { list: vi.fn().mockResolvedValue([]) },
  },
}));

describe("App", () => {
  it("renders the top bar and main content area", () => {
    render(
      <MemoryRouter initialEntries={["/weekly"]}>
        <App />
      </MemoryRouter>,
    );
    expect(screen.getByText("TimeTracker")).toBeDefined();
    expect(screen.getByRole("main")).toBeDefined();
  });
});
