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>
29 lines
1.2 KiB
TypeScript
29 lines
1.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { areAllEmptyStepsAutoHidden, deriveAutoHiddenStepIds } from "./auto-hide-empty-columns";
|
|
|
|
const steps = [{ id: "backlog" }, { id: "doing" }, { id: "done" }];
|
|
|
|
describe("deriveAutoHiddenStepIds", () => {
|
|
it("hides only unoccupied live steps when enabled", () => {
|
|
const result = deriveAutoHiddenStepIds(steps, [{ workflowStepId: "doing" }], true, []);
|
|
expect([...result]).toEqual(["backlog", "done"]);
|
|
});
|
|
|
|
it("returns no automatic hidden steps when disabled", () => {
|
|
expect([...deriveAutoHiddenStepIds(steps, [], false, [])]).toEqual([]);
|
|
});
|
|
|
|
it("leaves manually hidden steps to the manual visibility contract", () => {
|
|
const result = deriveAutoHiddenStepIds(steps, [], true, ["backlog"]);
|
|
expect([...result]).toEqual(["doing", "done"]);
|
|
});
|
|
});
|
|
|
|
describe("areAllEmptyStepsAutoHidden", () => {
|
|
it("distinguishes auto-hidden steps from a workflow with no configured steps", () => {
|
|
expect(areAllEmptyStepsAutoHidden([], [{ id: "todo" }])).toBe(true);
|
|
expect(areAllEmptyStepsAutoHidden([], [])).toBe(false);
|
|
expect(areAllEmptyStepsAutoHidden([{ id: "todo" }], [{ id: "todo" }])).toBe(false);
|
|
});
|
|
});
|