feat(housekeeping): integrate studio operations
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { OperationProgress } from "./operation-progress";
|
||||
import { OperationResult } from "./operation-result";
|
||||
|
||||
describe("Studio operation components", () => {
|
||||
it("renders determinate progress with an accessible label", () => {
|
||||
const markup = renderToStaticMarkup(
|
||||
<OperationProgress
|
||||
event={{
|
||||
operationId: "op-1",
|
||||
kind: "furni",
|
||||
phase: "running",
|
||||
completed: 2,
|
||||
total: 4,
|
||||
messageKey: "pages.housekeeping.studio.running",
|
||||
correlationId: "corr-1",
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
expect(markup).toContain('role="progressbar"');
|
||||
expect(markup).toContain('aria-valuenow="2"');
|
||||
expect(markup).toContain("2 / 4");
|
||||
});
|
||||
|
||||
it("distinguishes partial and failed terminal results", () => {
|
||||
const partial = renderToStaticMarkup(
|
||||
<OperationResult
|
||||
operation={{
|
||||
operationId: "op-1",
|
||||
kind: "sync",
|
||||
phase: "partial",
|
||||
completed: 8,
|
||||
total: 10,
|
||||
messageKey: "pages.housekeeping.studio.partial",
|
||||
correlationId: "corr-1",
|
||||
actorId: 42,
|
||||
createdAt: "2026-08-30T10:00:00.000Z",
|
||||
updatedAt: "2026-08-30T10:01:00.000Z",
|
||||
output: { succeeded: 8, failed: 2 },
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
expect(partial).toContain('data-operation-result="partial"');
|
||||
expect(partial).toContain("corr-1");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user