forked from wangziqi/gongxue-base
test: write stable launch persona evidence
This commit is contained in:
48
scripts/launch-persona-smoke-test.js
Normal file
48
scripts/launch-persona-smoke-test.js
Normal file
@@ -0,0 +1,48 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import path from 'node:path';
|
||||
import { parseCliArgs } from './launch-persona-smoke.js';
|
||||
|
||||
const repoRoot = process.cwd();
|
||||
|
||||
const writeOnly = parseCliArgs(['--write', 'docs/refactor/launch-artifacts/launch-persona-smoke.json']);
|
||||
assert.equal(
|
||||
writeOnly.writePath,
|
||||
path.resolve(repoRoot, 'docs/refactor/launch-artifacts/launch-persona-smoke.json'),
|
||||
'--write should resolve stable JSON evidence paths from the repo root',
|
||||
);
|
||||
assert.equal(writeOnly.writeMdPath, '', '--write should not imply a stable Markdown report path');
|
||||
|
||||
const equalsForm = parseCliArgs([
|
||||
'--output-dir=docs/refactor/launch-artifacts',
|
||||
'--write=docs/refactor/launch-artifacts/launch-persona-smoke.json',
|
||||
'--write-md=docs/refactor/launch-artifacts/launch-persona-smoke.md',
|
||||
'--json',
|
||||
]);
|
||||
assert.equal(
|
||||
equalsForm.outputDir,
|
||||
path.resolve(repoRoot, 'docs/refactor/launch-artifacts'),
|
||||
'--output-dir should resolve stable report directories',
|
||||
);
|
||||
assert.equal(
|
||||
equalsForm.writePath,
|
||||
path.resolve(repoRoot, 'docs/refactor/launch-artifacts/launch-persona-smoke.json'),
|
||||
'--write= should resolve stable JSON evidence paths',
|
||||
);
|
||||
assert.equal(
|
||||
equalsForm.writeMdPath,
|
||||
path.resolve(repoRoot, 'docs/refactor/launch-artifacts/launch-persona-smoke.md'),
|
||||
'--write-md= should resolve stable Markdown evidence paths',
|
||||
);
|
||||
|
||||
assert.throws(
|
||||
() => parseCliArgs(['--write']),
|
||||
/requires a file path value/,
|
||||
'--write without a value should fail fast',
|
||||
);
|
||||
assert.throws(
|
||||
() => parseCliArgs(['--unknown']),
|
||||
/Unknown launch persona smoke option/,
|
||||
'unknown options should fail fast instead of silently dropping evidence paths',
|
||||
);
|
||||
|
||||
console.log('[PASS] launch persona smoke cli options');
|
||||
Reference in New Issue
Block a user