test(replay-ui): dedup step/summary fixtures into shared module

This commit is contained in:
pj committed 2026-06-06 13:44:32 +05:30
1 parent 3cd1319f90
commit b19595c5c8
4 files changed
+23 -33

No files matched your search

+1 -11
View File
@@ -5,17 +5,7 @@ import {
parseSelector,
tagFromSelector,
} from "../lib/action-format";
import type { StepSummary } from "../types";
function summary(over: Partial<StepSummary>): StepSummary {
return {
index: 0,
timestamp: "1970-01-01T00:00:00.000Z",
has_violations: false,
has_exceptions: false,
...over,
};
}
import { summary } from "./fixtures";
// Bug class: selector parsing mislabels every action row — splitting on the
// wrong colon, treating a value-with-colon as the kind, or dropping the prefix
+15
View File
@@ -0,0 +1,15 @@
import type { Step, StepSummary } from "../types";
export function step(over: Partial<Step>): Step {
return { step: 0, timestamp: "1970-01-01T00:00:00.000Z", ...over };
}
export function summary(over: Partial<StepSummary>): StepSummary {
return {
index: 0,
timestamp: "1970-01-01T00:00:00.000Z",
has_violations: false,
has_exceptions: false,
...over,
};
}
@@ -4,7 +4,7 @@ import {
statusFor,
statusForStep,
} from "../lib/property-status";
import type { Step } from "../types";
import { step } from "./fixtures";
// Bug class: RunDetail and ViolationsPanel once carried two copies of this
// status logic; if they drift, the same property shows a different verdict in
@@ -22,14 +22,12 @@ describe("statusFor", () => {
describe("statusForStep", () => {
it("matches statusFor for the same step and is pending for a null step", () => {
const step: Step = {
step: 0,
timestamp: "1970-01-01T00:00:00.000Z",
const s = step({
violations: ["v"],
residuals: { v: { op: "true" }, h: { op: "true" } },
};
expect(statusForStep("v", step)).toBe("violated");
expect(statusForStep("h", step)).toBe("holds");
});
expect(statusForStep("v", s)).toBe("violated");
expect(statusForStep("h", s)).toBe("holds");
expect(statusForStep("v", null)).toBe("pending");
});
});
+2 -15
View File
@@ -6,21 +6,8 @@ import {
statusForProperty,
} from "../lib/run-history";
import type { PropertyLane } from "../panels/Timeline";
import type { Run, Step, StepSummary } from "../types";
function step(over: Partial<Step>): Step {
return { step: 0, timestamp: "1970-01-01T00:00:00.000Z", ...over };
}
function summary(over: Partial<StepSummary>): StepSummary {
return {
index: 0,
timestamp: "1970-01-01T00:00:00.000Z",
has_violations: false,
has_exceptions: false,
...over,
};
}
import type { Run } from "../types";
import { step, summary } from "./fixtures";
function lane(name: string, statuses: PropertyLane["statuses"]): PropertyLane {
return { name, statuses };