Tag: Sinon
-
ES6 + Mocha + Sinon: Mocking Imported Dependency
PROBLEM Let’s assume we have the following 2 files:- apis.js service.js Let’s assume we want to test the logic in service.js without using nock to mock the HTTP call in apis.js. While proxyquireify allows us to mock out the apis.js dependency in service.js, sometimes it is a little more complicated than needed. SOLUTION A simpler… Read More…