import React from "react";
import { renderToStaticMarkup } from "react-dom/server";
import { describe, expect, it } from "vitest";
import { OrdersCalendarView } from "./OrdersCalendarView";

const orders = [
  {
    id: "o-1",
    orderNumber: "CD-240031",
    customer: { name: "Мария Волкова" },
    deliverySlots: [{ date: "2026-03-14" }],
    scheduledDelivery: "2026-03-14T09:00:00Z",
  },
];

describe("OrdersCalendarView", () => {
  it("renders mobile agenda list alongside desktop calendar grid", () => {
    const markup = renderToStaticMarkup(
      <OrdersCalendarView orders={orders} onOpenOrder={() => {}} />,
    );

    expect(markup).toContain("md:hidden");
    expect(markup).toContain("hidden md:block");
    expect(markup).toContain("Заказы по дням");
    expect(markup).toContain("CD-240031");
  });
});
