import assert from 'node:assert/strict'; import fs from 'node:fs'; import path from 'node:path'; import test from 'node:test'; import { fileURLToPath } from 'node:url'; const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..', '..'); void test('video playback: renderer hooks/components do not tick React each frame', () => { const hookSrc = fs.readFileSync( path.join(root, 'app', 'renderer', 'shared', 'video', 'useVideoPlaybackState.ts'), 'utf8', ); // Регресс: раньше был setInterval(250ms) для clientNowMs, который заставлял перерисовываться окна. assert.doesNotMatch(hookSrc, /\bsetInterval\s*\(/); const previewSrc = fs.readFileSync( path.join(root, 'app', 'renderer', 'control', 'ControlScenePreview.tsx'), 'utf8', ); // Регресс: раньше был RAF loop с setState на каждом кадре. assert.doesNotMatch(previewSrc, /\brequestAnimationFrame\s*\(\s*loop\s*\)/); assert.doesNotMatch(previewSrc, /\brequestAnimationFrame\s*\(\s*loop\b/); // timeupdate пишет scrub в DOM, без setState корня превью (дорого поверх декода видео). assert.doesNotMatch(previewSrc, /\bsetTick\b/); assert.ok(previewSrc.includes('paintScrub')); assert.ok(previewSrc.includes('scrubFillRef')); }); void test('editor scene cards do not decode full video files', () => { const graph = fs.readFileSync( path.join(root, 'app', 'renderer', 'editor', 'graph', 'SceneGraph.tsx'), 'utf8', ); const editor = fs.readFileSync( path.join(root, 'app', 'renderer', 'editor', 'EditorApp.tsx'), 'utf8', ); assert.doesNotMatch(graph, /