// packages/netabrowser-cli/tests/output-formatter.test.ts import { formatOutput } from '../src/output/formatter.js'; describe('formatter', () => { it('--raw → 单行 JSON', () => { expect(formatOutput({ a: 1 }, true)).toBe('{"a":1}'); }); it('snapshot refs → 友好输出', () => { const r = formatOutput([{ ref: 'e1', tag: 'button', text: 'OK' }]); expect(r).toContain('[e1] button: OK'); }); it('普通对象 → 格式化 JSON', () => { const r = formatOutput({ ok: true }); expect(r).toBe('{\n "ok": true\n}'); }); });