test(golden): expand phases/validate/roadmap parity matrix (#2909)
Merging parity-matrix expansion after stack foundation.
This commit is contained in:
74
tests/phases-command-router.test.cjs
Normal file
74
tests/phases-command-router.test.cjs
Normal file
@@ -0,0 +1,74 @@
|
||||
'use strict';
|
||||
|
||||
const { describe, test } = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
|
||||
const { routePhasesCommand } = require('../get-shit-done/bin/lib/phases-command-router.cjs');
|
||||
|
||||
describe('phases-command-router', () => {
|
||||
test('routes phases list with parsed options', () => {
|
||||
const calls = [];
|
||||
const phase = {
|
||||
cmdPhasesList: (cwd, options, raw) => calls.push({ cwd, options, raw }),
|
||||
};
|
||||
|
||||
routePhasesCommand({
|
||||
phase,
|
||||
milestone: {},
|
||||
args: ['phases', 'list', '--type', 'plans', '--phase', '10', '--include-archived'],
|
||||
cwd: '/tmp/proj',
|
||||
raw: true,
|
||||
error: (msg) => {
|
||||
throw new Error(msg);
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(calls.length, 1);
|
||||
assert.deepEqual(calls[0], {
|
||||
cwd: '/tmp/proj',
|
||||
options: { type: 'plans', phase: '10', includeArchived: true },
|
||||
raw: true,
|
||||
});
|
||||
});
|
||||
|
||||
test('routes phases clear with trailing args', () => {
|
||||
const calls = [];
|
||||
const milestone = {
|
||||
cmdPhasesClear: (cwd, raw, trailing) => calls.push({ cwd, raw, trailing }),
|
||||
};
|
||||
|
||||
routePhasesCommand({
|
||||
phase: {},
|
||||
milestone,
|
||||
args: ['phases', 'clear', '--confirm'],
|
||||
cwd: '/tmp/proj',
|
||||
raw: false,
|
||||
error: (msg) => {
|
||||
throw new Error(msg);
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(calls.length, 1);
|
||||
assert.deepEqual(calls[0], {
|
||||
cwd: '/tmp/proj',
|
||||
raw: false,
|
||||
trailing: ['--confirm'],
|
||||
});
|
||||
});
|
||||
|
||||
test('errors on unknown phases subcommand', () => {
|
||||
let message = null;
|
||||
routePhasesCommand({
|
||||
phase: {},
|
||||
milestone: {},
|
||||
args: ['phases', 'archive'],
|
||||
cwd: '/tmp/proj',
|
||||
raw: false,
|
||||
error: (msg) => {
|
||||
message = msg;
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(message, 'Unknown phases subcommand. Available: list, clear');
|
||||
});
|
||||
});
|
||||
76
tests/roadmap-command-router.test.cjs
Normal file
76
tests/roadmap-command-router.test.cjs
Normal file
@@ -0,0 +1,76 @@
|
||||
'use strict';
|
||||
|
||||
const { describe, test } = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
|
||||
const { routeRoadmapCommand } = require('../get-shit-done/bin/lib/roadmap-command-router.cjs');
|
||||
|
||||
describe('roadmap-command-router', () => {
|
||||
test('routes roadmap analyze', () => {
|
||||
const calls = [];
|
||||
const roadmap = {
|
||||
cmdRoadmapAnalyze: (cwd, raw) => calls.push({ cwd, raw }),
|
||||
};
|
||||
|
||||
routeRoadmapCommand({
|
||||
roadmap,
|
||||
args: ['roadmap', 'analyze'],
|
||||
cwd: '/tmp/proj',
|
||||
raw: true,
|
||||
error: (msg) => {
|
||||
throw new Error(msg);
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(calls.length, 1);
|
||||
assert.deepEqual(calls[0], { cwd: '/tmp/proj', raw: true });
|
||||
});
|
||||
|
||||
test('routes roadmap get-phase and update-plan-progress with phase arg', () => {
|
||||
const calls = [];
|
||||
const roadmap = {
|
||||
cmdRoadmapGetPhase: (cwd, phase, raw) => calls.push({ kind: 'get', cwd, phase, raw }),
|
||||
cmdRoadmapUpdatePlanProgress: (cwd, phase, raw) => calls.push({ kind: 'update', cwd, phase, raw }),
|
||||
};
|
||||
|
||||
routeRoadmapCommand({
|
||||
roadmap,
|
||||
args: ['roadmap', 'get-phase', '10'],
|
||||
cwd: '/tmp/proj',
|
||||
raw: false,
|
||||
error: (msg) => {
|
||||
throw new Error(msg);
|
||||
},
|
||||
});
|
||||
|
||||
routeRoadmapCommand({
|
||||
roadmap,
|
||||
args: ['roadmap', 'update-plan-progress', '10'],
|
||||
cwd: '/tmp/proj',
|
||||
raw: false,
|
||||
error: (msg) => {
|
||||
throw new Error(msg);
|
||||
},
|
||||
});
|
||||
|
||||
assert.deepEqual(calls, [
|
||||
{ kind: 'get', cwd: '/tmp/proj', phase: '10', raw: false },
|
||||
{ kind: 'update', cwd: '/tmp/proj', phase: '10', raw: false },
|
||||
]);
|
||||
});
|
||||
|
||||
test('errors on unknown roadmap subcommand', () => {
|
||||
let message = null;
|
||||
routeRoadmapCommand({
|
||||
roadmap: {},
|
||||
args: ['roadmap', 'nonsense'],
|
||||
cwd: '/tmp/proj',
|
||||
raw: false,
|
||||
error: (msg) => {
|
||||
message = msg;
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(message, 'Unknown roadmap subcommand. Available: analyze, get-phase, update-plan-progress, annotate-dependencies');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user