mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-02 07:03:28 +08:00
fix: box() off-by-one alignment, add 5 tests for readStdinJson and box alignment
- skill-create-output.js: fix top border being 1 char narrower than middle/bottom lines (width - title - 5 → width - title - 4) - Add box alignment regression test verifying all lines have equal width - Add 4 readStdinJson tests via subprocess (valid JSON, invalid JSON, empty stdin, nested objects) — last untested exported utility function - All 338 tests passing
This commit is contained in:
@@ -201,6 +201,31 @@ function runTests() {
|
||||
assert.ok(logs.length > 0, 'Should produce output without crash');
|
||||
})) passed++; else failed++;
|
||||
|
||||
// box() alignment regression test
|
||||
console.log('\nbox() alignment:');
|
||||
|
||||
if (test('top, middle, and bottom lines have equal visual width', () => {
|
||||
const output = new SkillCreateOutput('repo', { width: 40 });
|
||||
const logs = captureLog(() => output.instincts([
|
||||
{ name: 'test', confidence: 0.9 },
|
||||
]));
|
||||
const combined = logs.join('\n');
|
||||
const boxLines = combined.split('\n').filter(l => stripAnsi(l).trim().length > 0);
|
||||
// Find lines that start with box-drawing characters
|
||||
const boxDrawn = boxLines.filter(l => {
|
||||
const s = stripAnsi(l).trim();
|
||||
return s.startsWith('\u256D') || s.startsWith('\u2502') || s.startsWith('\u2570');
|
||||
});
|
||||
if (boxDrawn.length >= 3) {
|
||||
const widths = boxDrawn.map(l => stripAnsi(l).length);
|
||||
const firstWidth = widths[0];
|
||||
widths.forEach((w, i) => {
|
||||
assert.strictEqual(w, firstWidth,
|
||||
`Line ${i} width ${w} should match first line width ${firstWidth}`);
|
||||
});
|
||||
}
|
||||
})) passed++; else failed++;
|
||||
|
||||
// Summary
|
||||
console.log(`\nResults: Passed: ${passed}, Failed: ${failed}`);
|
||||
process.exit(failed > 0 ? 1 : 0);
|
||||
|
||||
Reference in New Issue
Block a user