mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-06 06:01:31 -05:00
refactor(curriculum): remove Enzyme from reuseable profile (#58480)
Co-authored-by: Jessica Wilkins <67210629+jdwilkin4@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
3371ba8900
commit
afade4a5d3
@@ -58,6 +58,23 @@ async function initTestFrame(e: InitTestFrameArg = { code: {} }) {
|
||||
return o;
|
||||
};
|
||||
|
||||
const __prepTestComponent = async (
|
||||
component: React.ComponentType | React.FunctionComponent | string,
|
||||
props: Record<string, unknown>
|
||||
) => {
|
||||
const testDiv = document.createElement('div');
|
||||
const createdElement = window.React.createElement(component, props);
|
||||
|
||||
// @ts-expect-error the React version is determined at runtime so we can't define the types here
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/require-await
|
||||
await window.React?.act(async () => {
|
||||
// @ts-expect-error Same for ReactDOM as for React
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
||||
window.ReactDOM?.createRoot(testDiv).render(createdElement);
|
||||
});
|
||||
return testDiv;
|
||||
};
|
||||
|
||||
const { default: chai } = await import(/* webpackChunkName: "chai" */ 'chai');
|
||||
const assert = chai.assert;
|
||||
const __helpers = helpers;
|
||||
|
||||
Reference in New Issue
Block a user