Skip to content Skip to sidebar Skip to footer
Showing posts with the label Sinon

Stub A Standalone Module.exports Function Using Rewire

I am trying to stub a module.exports function. But I have some trouble. I will give you a sudo code… Read more Stub A Standalone Module.exports Function Using Rewire

How To Stub/mock Submodules Of A Require Of Nodejs Using Sinon

I am using sinon as for unit testing a nodejs(Hapijs) functionality. This function is in index.js. … Read more How To Stub/mock Submodules Of A Require Of Nodejs Using Sinon

Sinon Spy Function Called But Not Tracked

I am using Mocha and sinon to spy on a function call. The function is called correctly but the spy … Read more Sinon Spy Function Called But Not Tracked

Sinonjs - Advance Clock To 59 Minutes And Wait For 1 Minute Actually

I've a web component for auto-logout functionality which shows modal window with a message on 5… Read more Sinonjs - Advance Clock To 59 Minutes And Wait For 1 Minute Actually

Spying On Date Constructor With Sinon

I have a method that sets expiration date of a token: var jwt = require('jwt-simple'); modu… Read more Spying On Date Constructor With Sinon

Sinon Clock.tick Doesn't Advance Time For Settimeout

I am writing a test for an async function which performs a series of tasks and at one point waits f… Read more Sinon Clock.tick Doesn't Advance Time For Settimeout

Test Simple Logger Functions With Full Code Coverage

I'm using Chai, Sinon and Instanbul to test a NodeJS application. Here's the Logger code: i… Read more Test Simple Logger Functions With Full Code Coverage

Sinon Spy On Function Not Working

I'm trying to write a standalone test for this simple middleware function function onlyInternal… Read more Sinon Spy On Function Not Working