我正在使用无头 UI
Dialog, Transition
组件,我在使用反应测试库编写测试用例Cannot read properties of null (reading 'getElementById')
时遇到以下错误所以我如何在反应测试库中模拟 Document.getElementByID?
describe('Testing Component', () => {
test('It should render component', () => {
render(
<Edit
form={form}
phoneNumber={phoneNumber}
appId={appId}
/>,
);
const isItRendered = screen.getByTestId('lending_editAPP');
expect(isItRendered).toBeInTheDocument();
});
});