[removed] Mocking Constructor using Sinon

前端 未结 8 2112
迷失自我
迷失自我 2021-02-06 20:47

I am pulling my hair out trying to figure out how to mock a constructor using sinon. I have a function that will create multiple widgets by calling a constructor that accepts a

8条回答
  •  南方客
    南方客 (楼主)
    2021-02-06 21:42

    Just found this in the documentation.

    If you want to create a stub object of MyConstructor, but don’t want the constructor to be invoked, use this utility function.

    var stub = sinon.createStubInstance(MyConstructor)

提交回复
热议问题