mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 03:57:09 +00:00
test(replay-ui): dedup step/summary fixtures into shared module
This commit is contained in:
1 parent
3cd1319f90
commit
b19595c5c8
4 files changed
+23
-33
No files matched your search
@@ -5,17 +5,7 @@ import {
|
|||||||
parseSelector,
|
parseSelector,
|
||||||
tagFromSelector,
|
tagFromSelector,
|
||||||
} from "../lib/action-format";
|
} from "../lib/action-format";
|
||||||
import type { StepSummary } from "../types";
|
import { summary } from "./fixtures";
|
||||||
|
|
||||||
function summary(over: Partial<StepSummary>): StepSummary {
|
|
||||||
return {
|
|
||||||
index: 0,
|
|
||||||
timestamp: "1970-01-01T00:00:00.000Z",
|
|
||||||
has_violations: false,
|
|
||||||
has_exceptions: false,
|
|
||||||
...over,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bug class: selector parsing mislabels every action row — splitting on the
|
// 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
|
// wrong colon, treating a value-with-colon as the kind, or dropping the prefix
|
||||||
|
|||||||
@@ -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,
|
statusFor,
|
||||||
statusForStep,
|
statusForStep,
|
||||||
} from "../lib/property-status";
|
} from "../lib/property-status";
|
||||||
import type { Step } from "../types";
|
import { step } from "./fixtures";
|
||||||
|
|
||||||
// Bug class: RunDetail and ViolationsPanel once carried two copies of this
|
// Bug class: RunDetail and ViolationsPanel once carried two copies of this
|
||||||
// status logic; if they drift, the same property shows a different verdict in
|
// status logic; if they drift, the same property shows a different verdict in
|
||||||
@@ -22,14 +22,12 @@ describe("statusFor", () => {
|
|||||||
|
|
||||||
describe("statusForStep", () => {
|
describe("statusForStep", () => {
|
||||||
it("matches statusFor for the same step and is pending for a null step", () => {
|
it("matches statusFor for the same step and is pending for a null step", () => {
|
||||||
const step: Step = {
|
const s = step({
|
||||||
step: 0,
|
|
||||||
timestamp: "1970-01-01T00:00:00.000Z",
|
|
||||||
violations: ["v"],
|
violations: ["v"],
|
||||||
residuals: { v: { op: "true" }, h: { op: "true" } },
|
residuals: { v: { op: "true" }, h: { op: "true" } },
|
||||||
};
|
});
|
||||||
expect(statusForStep("v", step)).toBe("violated");
|
expect(statusForStep("v", s)).toBe("violated");
|
||||||
expect(statusForStep("h", step)).toBe("holds");
|
expect(statusForStep("h", s)).toBe("holds");
|
||||||
expect(statusForStep("v", null)).toBe("pending");
|
expect(statusForStep("v", null)).toBe("pending");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,21 +6,8 @@ import {
|
|||||||
statusForProperty,
|
statusForProperty,
|
||||||
} from "../lib/run-history";
|
} from "../lib/run-history";
|
||||||
import type { PropertyLane } from "../panels/Timeline";
|
import type { PropertyLane } from "../panels/Timeline";
|
||||||
import type { Run, Step, StepSummary } from "../types";
|
import type { Run } from "../types";
|
||||||
|
import { step, summary } from "./fixtures";
|
||||||
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,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function lane(name: string, statuses: PropertyLane["statuses"]): PropertyLane {
|
function lane(name: string, statuses: PropertyLane["statuses"]): PropertyLane {
|
||||||
return { name, statuses };
|
return { name, statuses };
|
||||||
|
|||||||
Reference in new issue
Block a user