[removed] Mocking Constructor using Sinon

前端 未结 8 2261
迷失自我
迷失自我 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:27

    Use sinon.createStubInstance(MyES6ClassName), then when MyES6ClassName is called with a new keyword, a stub of MyES6ClassName instance will returned.

提交回复
热议问题