import React from "react";
import { renderToStaticMarkup } from "react-dom/server";
import { describe, expect, it } from "vitest";
import { OrderDetailPanel } from "./OrderDetailPanel";
const order = {
id: "o-1",
orderNumber: "CD-240031",
status: "Ожидает согласования доставки",
deliveryAgreementStatus: "Ожидание ответа",
managerId: "u-manager",
logisticianIds: ["u-logistics"],
assignedDriverId: null,
createdAt: "2026-03-15T08:00:00Z",
scheduledDelivery: "2026-03-16T09:00:00Z",
customer: {
name: "Мария Волкова",
phone: "+7 978 000-12-31",
address: "Симферополь",
messenger: "Телеграм",
},
items: ["Кухня | 1 шт"],
chatMessages: [],
internalMessages: [],
orderNotes: [],
history: [],
};
describe("OrderDetailPanel", () => {
it("keeps the order card read-first without workflow controls", () => {
const markup = renderToStaticMarkup(
,
);
expect(markup).toContain("CD-240031");
expect(markup).toContain("Мария Волкова");
expect(markup).toContain("Кухня");
expect(markup).toContain("1 шт");
expect(markup).not.toContain("Назначение водителя");
expect(markup).not.toContain("Изменить статус");
expect(markup).not.toContain("Чат с клиентом");
expect(markup).not.toContain("Команда");
});
it("does not crash when an order contains invalid date strings", () => {
const markup = renderToStaticMarkup(
,
);
expect(markup).toContain("Не указано");
});
it("does not expose driver assignment or status controls", () => {
const markup = renderToStaticMarkup();
expect(markup).not.toContain("Назначение водителя");
expect(markup).not.toContain("Изменить статус");
expect(markup).not.toContain("Чат с клиентом");
expect(markup).not.toContain("Команда");
});
});