Допустим, я хочу проверить эту функцию:
function thisFunctionWillBeTested(){
const activeXObejct = new ActiveXObject('Something.App');
//And do more after ActiveXObject is created.
}
Теперь я хочу протестировать эту функцию, но не знаю, как смоделировать создание объекта:
test('test of my function', () => {
// Arrange
//I need to Mock >ActiveXobject here
//Act
const returnValue = thisFunctionWillBeTested();
//Assert
expect(returnValue).toBe(10);
});