Desktop: every write shows a styled in-app dry-run preview (command, changed rows) before the native confirm dialog; i18n house style fix for the developer id hint

This commit is contained in:
CRTkafa 2026-10-23 09:48:48 +08:00
parent c86b583830
commit 364b8ec0d4
7 changed files with 78 additions and 2 deletions

View file

@ -0,0 +1,15 @@
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);
});