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

const orderGroups = [
  {
    id: "driver-order-1",
    groupKey: "9780001231|16.04.26",
    displayTitle: "Мария Волкова",
    displaySubtitle: "+7 978 000-12-31 · 16.04.26",
    customerName: "Мария Волкова",
    customerPhone: "+7 978 000-12-31",
    customerDate: "16.04.26",
    orderNumbers: ["CD-240031"],
    ordersCount: 1,
    readyCount: 1,
    notReadyCount: 0,
    status: "ready_for_notification",
    deliveryStatus: "agreed",
    deliveryHalfDay: "Первая половина дня",
    smsSentAt: null,
    updatedAt: "2026-04-16T12:00:00Z",
  },
  {
    id: "driver-order-2",
    groupKey: "9780001232|16.04.26",
    displayTitle: "Не показывать",
    customerName: "Не показывать",
    customerPhone: "+7 978 000-12-32",
    customerDate: "16.04.26",
    orderNumbers: ["CD-240032"],
    ordersCount: 1,
    readyCount: 0,
    notReadyCount: 1,
    status: "manual_work",
    deliveryStatus: "pending_confirmation",
    deliveryHalfDay: "Вторая половина дня",
    smsSentAt: null,
    updatedAt: "2026-04-16T13:00:00Z",
  },
];

describe("DriverDeliveryPlanner", () => {
  it("renders a simple delivery list without kanban or route editing", () => {
    const markup = renderToStaticMarkup(
      <DriverDeliveryPlanner
        orderGroups={orderGroups}
        onOpenOrder={() => {}}
      />,
    );

    expect(markup).toContain("Мои доставки");
    expect(markup).toContain("1 доставка");
    expect(markup).toContain("Мария Волкова");
    expect(markup).toContain("CD-240031");
    expect(markup).not.toContain("Не показывать");
    expect(markup).toContain("Дата от");
    expect(markup).toContain("Время суток");
    expect(markup).toContain("Статус");
    expect(markup).toContain("Согласовано");
    expect(markup).not.toContain("Канбан");
    expect(markup).not.toContain("Перетащите");
    expect(markup).not.toContain("Календарь");
  });
});
