/* eslint-env jest */ import { act } from 'react'; import { createRoot, type Root } from 'react-dom/client'; import { analyze } from '../../analysis/analyzer'; import { PrePublishSummary } from '../PrePublishSummary'; ( globalThis as unknown as { IS_REACT_ACT_ENVIRONMENT: boolean } ).IS_REACT_ACT_ENVIRONMENT = true; let root: Root; let host: HTMLDivElement; beforeEach(() => { host = document.createElement('div'); document.body.appendChild(host); root = createRoot(host); }); afterEach(() => { act(() => root.unmount()); host.remove(); }); const page = { title: 'Zipper hoodie: warm and light | Shop', description: 'The zipper hoodie for cold mornings.', slug: 'zipper-hoodie', content: '
The zipper hoodie keeps you warm.
', hasFeaturedImage: false, siteHost: 'shop.example', }; describe('PrePublishSummary', () => { it('says the score, the keyword, the tests to fix and opens the panel', () => { const onOpen = jest.fn(); const analysis = analyze({ ...page, keyword: 'zipper hoodie' }); act(() => root.render(