feat(FN-4723): complete Step 1 — add worktrunk transition classifier
Fusion-Task-Id: FN-4723 Fusion-Task-Lineage: b79b42a0-c65d-4e02-938f-d1ffabc272ee
This commit is contained in:
committed by
gsxdsm
parent
6afd2737ad
commit
43e3fbf60d
@@ -1,6 +1,10 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { DEFAULT_GLOBAL_SETTINGS, DEFAULT_PROJECT_SETTINGS } from "../settings-schema.js";
|
||||
import { resolveWorktrunkSettings, validateWorktrunkSettings } from "../worktrunk-settings.js";
|
||||
import {
|
||||
resolveWorktrunkSettings,
|
||||
requiresWorktrunkInstallVerification,
|
||||
validateWorktrunkSettings,
|
||||
} from "../worktrunk-settings.js";
|
||||
|
||||
describe("settings defaults invariants", () => {
|
||||
it("keeps worktrunk default off in global and project defaults", () => {
|
||||
@@ -25,4 +29,15 @@ describe("settings defaults invariants", () => {
|
||||
it("does not implicitly enable worktrunk when validating undefined", () => {
|
||||
expect(validateWorktrunkSettings(undefined)).toEqual({});
|
||||
});
|
||||
|
||||
it("flags off→on transition from fresh defaults", () => {
|
||||
const freshProject = resolveWorktrunkSettings(DEFAULT_GLOBAL_SETTINGS.worktrunk, DEFAULT_PROJECT_SETTINGS.worktrunk);
|
||||
expect(freshProject.enabled).toBe(false);
|
||||
expect(
|
||||
requiresWorktrunkInstallVerification({
|
||||
current: freshProject,
|
||||
next: { ...freshProject, enabled: true },
|
||||
}),
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
resolveWorktrunkSettings,
|
||||
requiresWorktrunkInstallVerification,
|
||||
validateWorktrunkSettings,
|
||||
} from "../worktrunk-settings.js";
|
||||
|
||||
@@ -40,6 +41,14 @@ describe("worktrunk-settings", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("classifies enable transitions that require install verification", () => {
|
||||
expect(requiresWorktrunkInstallVerification({ current: { enabled: false }, next: { enabled: true } })).toBe(true);
|
||||
expect(requiresWorktrunkInstallVerification({ current: { enabled: true }, next: { enabled: true } })).toBe(false);
|
||||
expect(requiresWorktrunkInstallVerification({ current: { enabled: true }, next: { enabled: false } })).toBe(false);
|
||||
expect(requiresWorktrunkInstallVerification({ current: undefined, next: undefined })).toBe(false);
|
||||
expect(requiresWorktrunkInstallVerification({ current: undefined, next: { enabled: true } })).toBe(true);
|
||||
});
|
||||
|
||||
it("validator rejects invalid values", () => {
|
||||
expect(() => validateWorktrunkSettings({ onFailure: "ignore" })).toThrow(
|
||||
"worktrunk.onFailure must be one of",
|
||||
|
||||
Reference in New Issue
Block a user