| 15 | |
| 16 | // Helper to mock stdout dimensions cleanly without boilerplate |
| 17 | function runWithMockStdout(columns, rows, fn) { |
| 18 | const origColumns = process.stdout.columns; |
| 19 | const origRows = process.stdout.rows; |
| 20 | try { |
| 21 | Object.defineProperty(process.stdout, 'columns', { |
| 22 | value: columns, |
| 23 | writable: true, |
| 24 | configurable: true |
| 25 | }); |
| 26 | Object.defineProperty(process.stdout, 'rows', { |
| 27 | value: rows, |
| 28 | writable: true, |
| 29 | configurable: true |
| 30 | }); |
| 31 | fn(); |
| 32 | } finally { |
| 33 | Object.defineProperty(process.stdout, 'columns', { value: origColumns, configurable: true }); |
| 34 | Object.defineProperty(process.stdout, 'rows', { value: origRows, configurable: true }); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | test('Fullscreen TUI welcome screen - responsive widths', () => { |
| 39 | const widths = [1, 8, 12, 19, 30, 40, 80, 120]; |