moving
Some checks failed
Installer Smoke / installer-smoke (push) Has been cancelled

This commit is contained in:
Oleg Maslov
2026-09-02 10:10:29 +02:00
commit 0c3e2ead3b
3841 changed files with 970576 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
import { describe, it, expect } from 'vitest';
import { renderGoalAncestry } from '../src/goal-ancestry.js';
describe('renderGoalAncestry', () => {
it('renders a heading + one line per present level, in mission→project→goal→task order', () => {
const out = renderGoalAncestry({ project: 'Acme', goal: 'Ship the pane', mission: 'Win', task: 'x' });
expect(out).toBe("# Why You're Here\nMission: Win\nProject: Acme\nGoal: Ship the pane\nTask: x");
});
it('renders only the present levels', () => {
expect(renderGoalAncestry({ project: 'Acme' })).toBe("# Why You're Here\nProject: Acme");
});
it('returns empty string for null / undefined / all-empty', () => {
expect(renderGoalAncestry(null)).toBe('');
expect(renderGoalAncestry(undefined)).toBe('');
expect(renderGoalAncestry({})).toBe('');
expect(renderGoalAncestry({ goal: '' })).toBe('');
});
it('truncates an over-long level to 200 chars', () => {
const long = 'x'.repeat(300);
const out = renderGoalAncestry({ goal: long });
const line = out.split('\n')[1];
expect(line.length).toBeLessThanOrEqual('Goal: '.length + 200);
expect(line.endsWith('...')).toBe(true);
});
});