import assert from 'node:assert/strict' import fs from 'node:fs' import test from 'node:test' const source = fs.readFileSync(new URL('../src/main.tsx', import.meta.url), 'utf8') const styles = fs.readFileSync(new URL('../src/styles.css', import.meta.url), 'utf8') test('ambient lake motion sleeps by default and wakes only after human interaction', () => { assert.match(source, /const \[motionAwake, setMotionAwake\] = useState\(false\)/) assert.match(source, /onPointerMove=\{wakeAmbientMotion\}/) assert.match(source, /onPointerDown=\{wakeAmbientMotion\}/) assert.match(source, /onKeyDown=\{wakeAmbientMotion\}/) assert.match(styles, /\.official-world \.world-star,[\s\S]*animation: none/) assert.match(styles, /\.official-world\.motion-awake \.world-star \{ animation: world-star-breathe/) }) test('the desktop shell has no permanent polling interval while idle', () => { assert.doesNotMatch(source, /setInterval\s*\(/) assert.match(source, /window\.addEventListener\('focus', refreshWhenHumanReturns\)/) assert.match(source, /document\.hidden/) }) test('causal entry animations remain independent from ambient motion', () => { assert.match(styles, /\.gate-rise-star[\s\S]*animation: gate-jade-rise/) assert.doesNotMatch(styles, /\.official-world \.gate-rise-star[\s\S]*animation-play-state: paused/) })