test: make uok-gitops-wiring assertion whitespace-tolerant

The test was checking for a literal single-line ternary in auto-post-unit.ts,
but the formatter naturally renders the same ternary multi-line. The semantic
content is identical; the test was failing on whitespace alone.

Normalize runs of whitespace before substring-matching so the assertion
survives prettier/biome formatting changes.

After this fix: 39/39 uok tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mikael Hugo 2026-05-02 01:21:36 +02:00
parent 9c20ebd76b
commit dda1bc1206

View file

@ -9,8 +9,13 @@ const sfDir = join(__dirname, "..");
test("post-unit pre-verification selects turn git action from UOK gitops flags", () => {
const source = readFileSync(join(sfDir, "auto-post-unit.ts"), "utf-8");
// Whitespace-tolerant: collapse runs of whitespace before substring-matching
// so the assertion survives formatter changes (single-line vs multi-line
// ternary). The semantic check is that turnAction is derived from
// uokFlags.gitops + uokFlags.gitopsTurnAction with a "commit" fallback.
const normalized = source.replace(/\s+/g, " ");
assert.ok(
source.includes(
normalized.includes(
'const turnAction: TurnGitActionMode = uokFlags.gitops ? uokFlags.gitopsTurnAction : "commit"',
),
"postUnitPreVerification should derive turn action from uok.gitops.turn_action when enabled",