b067fac875
Co-authored-by: nova28 <17953305+nova28@users.noreply.github.com> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> Co-authored-by: Carlos Florencio <carlosmflorencio@gmail.com>
20 lines
630 B
TypeScript
20 lines
630 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { sortWorkflowStepsByPosition } from "./workflow-step-order";
|
|
|
|
describe("sortWorkflowStepsByPosition", () => {
|
|
it("orders workflow steps deterministically without mutating the snapshot", () => {
|
|
const unordered = [
|
|
{ id: "step-b", position: 1 },
|
|
{ id: "step-c", position: 0 },
|
|
{ id: "step-a", position: 1 },
|
|
];
|
|
|
|
expect(sortWorkflowStepsByPosition(unordered).map((step) => step.id)).toEqual([
|
|
"step-c",
|
|
"step-a",
|
|
"step-b",
|
|
]);
|
|
expect(unordered.map((step) => step.id)).toEqual(["step-b", "step-c", "step-a"]);
|
|
});
|
|
});
|