import { describe, test, expect, vi, afterEach } from 'vitest'; import React from 'react'; import { createRoot, Root } from 'react-dom/client'; import { act } from 'react-dom/test-utils'; import { CodeEditor } from './CodeEditor'; /* ---------- DOM test harness (no @testing-library/react in this repo; see src/ui/AssetPicker.test.tsx / src/ui/Modal.test.tsx for the same react-dom/client + react-dom/test-utils `act` pattern). ---------- CodeMirror is loaded via dynamic import() (see CodeEditor.tsx), which is always async -- even for an already-resolved/cached module, `import()` only settles on a later microtask. That means immediately after the initial synchronous `act(() => root.render(...))` below, the component is still in its 'loading' state and renders the