flow-muse-commit-pilot-unit.test.mjs
sha256:8915fe406161f95c1681f9469375e7bae5b28c884f00bedbdef65e4b0cd0738d
docs(flow): commit FLOW-V0-SPEC.md hygiene for 7A-INT merge
Human
11 hours ago
| 1 | /** |
| 2 | * Unit tests — Muse commit pilot evidence validators (7A-14). |
| 3 | */ |
| 4 | |
| 5 | import { describe, it } from 'node:test'; |
| 6 | import assert from 'node:assert/strict'; |
| 7 | |
| 8 | import { |
| 9 | parseGeneratedMarkerVersion, |
| 10 | assertCleanAntiDriftDiff, |
| 11 | assertNoSecretLeakageInProjection, |
| 12 | } from '../lib/flow/muse-commit-pilot-evidence.mjs'; |
| 13 | |
| 14 | describe('muse-commit-pilot-evidence (unit, 7A-14)', () => { |
| 15 | it('parseGeneratedMarkerVersion extracts semver from marker line', () => { |
| 16 | const sample = `# Title |
| 17 | |
| 18 | <!-- GENERATED FROM CANONICAL FLOW [email protected] (generator v1) — DO NOT EDIT; regenerate via knowtation flow project --> |
| 19 | `; |
| 20 | assert.equal(parseGeneratedMarkerVersion(sample), '0.2.0'); |
| 21 | }); |
| 22 | |
| 23 | it('assertCleanAntiDriftDiff accepts two-line canonical + marker change', () => { |
| 24 | const diff = `--- a |
| 25 | +++ b |
| 26 | @@ -1,2 +1,2 @@ |
| 27 | -<!-- GENERATED FROM CANONICAL FLOW [email protected] (generator v1) — DO NOT EDIT --> |
| 28 | +<!-- GENERATED FROM CANONICAL FLOW [email protected] (generator v1) — DO NOT EDIT --> |
| 29 | -Docs-first handover … update durable docs, then regenerate … |
| 30 | +Docs-first handover … update the durable docs (ROADMAP snapshot, next-session plan, coordination doc), then regenerate … |
| 31 | `; |
| 32 | assert.deepEqual(assertCleanAntiDriftDiff(diff), { ok: true }); |
| 33 | }); |
| 34 | |
| 35 | it('assertCleanAntiDriftDiff rejects extra drift lines', () => { |
| 36 | const diff = `--- a |
| 37 | +++ b |
| 38 | @@ -1,3 +1,3 @@ |
| 39 | -old |
| 40 | +new |
| 41 | -extra |
| 42 | +drift |
| 43 | `; |
| 44 | const result = assertCleanAntiDriftDiff(diff); |
| 45 | assert.equal(result.ok, false); |
| 46 | }); |
| 47 | |
| 48 | it('assertNoSecretLeakageInProjection allows boundary instruction text', () => { |
| 49 | const content = `# Flow |
| 50 | |
| 51 | No secrets in captured output. |
| 52 | No secrets in the block. |
| 53 | `; |
| 54 | assert.deepEqual(assertNoSecretLeakageInProjection(content), { ok: true }); |
| 55 | }); |
| 56 | |
| 57 | it('assertNoSecretLeakageInProjection flags credential-like tokens', () => { |
| 58 | const content = 'api_key=super-secret-value'; |
| 59 | const result = assertNoSecretLeakageInProjection(content); |
| 60 | assert.equal(result.ok, false); |
| 61 | assert.ok(result.matches.length > 0); |
| 62 | }); |
| 63 | }); |
File History
1 commit
sha256:8915fe406161f95c1681f9469375e7bae5b28c884f00bedbdef65e4b0cd0738d
docs(flow): commit FLOW-V0-SPEC.md hygiene for 7A-INT merge
Human
11 hours ago