Hi I am new to Jest and I have a test as follows
test('Description', () => {
document.body.innerHTML = '<div id=\'holder\'></div>';
const dynamicData = {
dialogTitle: 'Testing innderDialog.show() method',
bodyContent: '<div>sample text</div>'
};
const onCloseMock = jest.fn();
const holder = document.querySelector('#holder');
console.log(holder.appendChild);
mymodule.show(dynamicData, document.querySelector('#holder'), onCloseMock, [], window);
});
mymodule's show method is as follows
show (dynamicData, holder, onClose, onCloseArg, onCloseCtx) {
holder.appendChild(/*generatedHTML*/);
}
This appendChild is throwing error. But when I try the samething in Jest test file it is working.
What am I doing wrong here? Am I missing something?
Aucun commentaire:
Enregistrer un commentaire