@@ -0,0 +1,51 @@
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { SummaryStatusControl } from "./SummaryStatusControl";
|
||||
|
||||
describe("SummaryStatusControl", () => {
|
||||
it("does not infer a missing component when startup data is unavailable", () => {
|
||||
const markup = renderToStaticMarkup(
|
||||
<SummaryStatusControl
|
||||
unavailable
|
||||
installed={false}
|
||||
running={false}
|
||||
working={false}
|
||||
checking={false}
|
||||
tone="warning"
|
||||
/>,
|
||||
);
|
||||
expect(markup).toContain("ProxyWarden: Нет данных");
|
||||
expect(markup).not.toContain("Не установлен");
|
||||
});
|
||||
it("renders an accessible status without a service mutation control", () => {
|
||||
const markup = renderToStaticMarkup(
|
||||
<SummaryStatusControl
|
||||
installed
|
||||
running
|
||||
working={false}
|
||||
checking={false}
|
||||
tone="ok"
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(markup).toContain('role="status"');
|
||||
expect(markup).toContain("ProxyWarden: Службы запущены");
|
||||
expect(markup).not.toContain("<button");
|
||||
expect(markup).not.toContain("aria-pressed");
|
||||
});
|
||||
|
||||
it("reports a missing component without presenting a disabled action", () => {
|
||||
const markup = renderToStaticMarkup(
|
||||
<SummaryStatusControl
|
||||
installed={false}
|
||||
running={false}
|
||||
working={false}
|
||||
checking={false}
|
||||
tone="warning"
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(markup).toContain("ProxyWarden: Не установлен");
|
||||
expect(markup).not.toContain("disabled");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user