15 lines
709 B
TypeScript
15 lines
709 B
TypeScript
import { expect, test } from 'bun:test';
|
|
import { previewLines } from '../src/ui/DryRunPreview';
|
|
|
|
test('change lines are picked from a dry run', () => {
|
|
const out = 'reading config\nconnected\n ~ en-US title: Old -> New\n + de-DE short description\ndone';
|
|
expect(previewLines(out).lines).toEqual([' ~ en-US title: Old -> New', ' + de-DE short description']);
|
|
});
|
|
test('no change lines: the last lines', () => {
|
|
expect(previewLines('a\nb\nc', 2).lines).toEqual(['b', 'c']);
|
|
});
|
|
test('long previews say how many more', () => {
|
|
const out = Array.from({ length: 20 }, (_, i) => `+ row ${i}`).join('\n');
|
|
const p = previewLines(out, 5);
|
|
expect(p.lines.length).toBe(5); expect(p.more).toBe(15);
|
|
});
|