如何使用Jest模拟ActiveXObject

时间:2018-12-03 14:57:30

标签: jestjs activexobject

假设我要测试此功能:

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);
});

0 个答案:

没有答案