import test from 'node:test'; import assert from 'node:assert/strict'; import { glitchText } from '../src/lib/landing-ascii.mjs'; const text = '┌────────┐\n│ object │\n└────────┘\n 本文: "sample";'; test('ASCII glitch preserves cells, whitespace and Japanese prose', () => { const output = glitchText(text, .2, 9, 2); assert.equal(output.length, text.length); assert.equal(output.match(/\s/g).join(''), text.match(/\s/g).join('')); assert.ok(output.includes('本文')); assert.notEqual(output, text); }); test('noise is reproducible and changes only with its explicit clock', () => { assert.equal(glitchText(text, .3, 1, 7), glitchText(text, .3, 1, 7)); assert.notEqual(glitchText(text, .3, 1, 7), glitchText(text, .3, 2, 7)); }); test('transition restores the exact source text at its boundary', () => { assert.equal(glitchText(text, 1, 99), text); assert.equal(glitchText(text, 2, 99), text); assert.equal(glitchText('', .5, 1), ''); });