Spaces:
Running
Running
| import { describe, expect, it } from "vitest"; | |
| import { getWorkPackageVersion, getWorkPackageVisualState } from "./work-package-ui"; | |
| import type { WorkPackage } from "./work-package-types"; | |
| const baseWorkPackage: WorkPackage = { | |
| id: "wp-test", | |
| title: "Test Package", | |
| shortName: "Test", | |
| phase: "Specify Product", | |
| objective: "Test objective", | |
| inputFiles: [], | |
| outputFiles: [], | |
| coreSections: [], | |
| tasks: [], | |
| outputs: [], | |
| status: "todo", | |
| priority: "medium", | |
| }; | |
| describe("work-package-ui", () => { | |
| it("derives version labels from output count", () => { | |
| expect(getWorkPackageVersion(baseWorkPackage)).toBeUndefined(); | |
| expect( | |
| getWorkPackageVersion({ | |
| ...baseWorkPackage, | |
| outputs: [ | |
| { | |
| id: "out-1", | |
| title: "Output", | |
| type: "text", | |
| content: "content", | |
| createdAt: "2026-01-01T00:00:00.000Z", | |
| executionMode: "real", | |
| disclaimer: "disclaimer", | |
| }, | |
| ], | |
| }), | |
| ).toBe("v1"); | |
| }); | |
| it("marks active work packages as running and done packages as complete", () => { | |
| expect( | |
| getWorkPackageVisualState({ | |
| workPackage: baseWorkPackage, | |
| activeWorkPackageId: "wp-test", | |
| }), | |
| ).toBe("running"); | |
| expect( | |
| getWorkPackageVisualState({ | |
| workPackage: { | |
| ...baseWorkPackage, | |
| status: "done", | |
| outputs: [ | |
| { | |
| id: "out-1", | |
| title: "Output", | |
| type: "text", | |
| content: "content", | |
| createdAt: "2026-01-01T00:00:00.000Z", | |
| executionMode: "real", | |
| disclaimer: "disclaimer", | |
| }, | |
| ], | |
| }, | |
| }), | |
| ).toBe("done"); | |
| }); | |
| }); | |