overleaf/services/web/test/frontend/helpers/render-with-context.jsx
Alf Eaton c24ace801b Remove Angular (#17534)
GitOrigin-RevId: 7a0d45e17d9905fa75569e2d19ca59caa4a41565
2024-06-06 08:04:09 +00:00

26 lines
611 B
JavaScript

// Disable prop type checks for test harnesses
/* eslint-disable react/prop-types */
import { render } from '@testing-library/react'
import { EditorProviders } from './editor-providers'
export function renderWithEditorContext(
component,
contextProps,
renderOptions = {}
) {
const EditorProvidersWrapper = ({ children }) => (
<EditorProviders {...contextProps}>{children}</EditorProviders>
)
return render(component, {
wrapper: EditorProvidersWrapper,
...renderOptions,
})
}
export function cleanUpContext() {
delete window.user
delete window.project_id
delete window._ide
}