// @vitest-environment jsdom import { act } from 'react'; import { createRoot } from 'react-dom/client'; import { expect, it, vi } from 'vitest'; import { ScoringMethodology } from '../../src/features/dashboard/ScoringMethodology'; it('discloses the mixed-method score and check basis in an operable dialog', () => { (globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true; const container = document.createElement('div'); const root = createRoot(container); const close = vi.fn(); try { act(() => root.render()); const dialog = document.querySelector('[role="dialog"]')!; expect(dialog.textContent).toContain('different methods'); expect(dialog.textContent).toContain('Rule 1.0.0'); expect(dialog.querySelector('tbody')?.textContent).toContain('66.67'); expect(dialog.querySelector('tbody')?.textContent).toContain('2 / 3 passed'); act(() => dialog.querySelector('[aria-label="Close window"]')!.click()); expect(close).toHaveBeenCalledOnce(); } finally { act(() => root.unmount()); } });