import "../../../tests/web/test-utils";
import { render } from "@testing-library/react";
import { describe, expect, test } from "bun:test";
import type { DashboardResponse } from "../../../src/shared/api";
import { SummaryCards } from "../../../src/web/components/SummaryCards";
describe("SummaryCards", () => {
const summary: DashboardResponse["summary"] = {
down: 2,
incidents: 1,
lastCheckTime: "2025-01-15T10:00:00.000Z",
total: 10,
up: 8,
window: {
from: "2025-01-14T10:00:00.000Z",
label: "24h",
to: "2025-01-15T10:00:00.000Z",
},
};
test("summary 为 null 时不渲染", () => {
const { container } = render();
expect(container.firstChild).toBeNull();
});
test("有数据不崩溃", () => {
const { container } = render();
expect(container.firstChild).not.toBeNull();
});
});