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

Test Node-schedule With Sinon Faketimers

I want to test my scheduleJob from the node-schedule package. With sinon useFakeTimers() i can skip… Read more Test Node-schedule With Sinon Faketimers

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 Mock Pg Pool With Sinon

In a previous project I mocked the mysql library with Sinon. I did this like so: X.js: const con =… Read more How To Mock Pg Pool With Sinon

Using Sinon Mocks With Nodeunit

I'm learning to use sinon with nodeunit, specifically to do mocking. The recommended approach … Read more Using Sinon Mocks With Nodeunit

How Does One Stub Promise With Sinon?

I have a data service with following function function getInsureds(searchCriteria) { var defer… Read more How Does One Stub Promise With Sinon?

Pulling In Sinon Submodules In Browser With Amd And Webpack

I'm running into the same problem described in this question. Basically sinon only pulls in all… Read more Pulling In Sinon Submodules In Browser With Amd And Webpack

Sinon - How To Stub Authentication Library (authy -twilio)

I am currently new to Sinon, Mocha, Supertest and in the process to writes tests. In my current sce… Read more Sinon - How To Stub Authentication Library (authy -twilio)

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

Any Better Way Than Settimeout To Wait For Asnyc Callbacks When Testing Javascript?

Given this code: showForm = function (url) { return $.get(url, function (html) { … Read more Any Better Way Than Settimeout To Wait For Asnyc Callbacks When Testing Javascript?

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

Stubbing Redis Interactions In Javascript Using Sinon

I am working in node.js. My app interacts with Redis via the node_redis module. I'm using moch… Read more Stubbing Redis Interactions In Javascript Using Sinon

Sinon - Stubbing Function With Callback - Causing Test Method To Timeout

I have a method on a express route that looks like this: exports.register_post = function(req, res)… Read more Sinon - Stubbing Function With Callback - Causing Test Method To Timeout

Undefined|0|ReferenceError: Strict Mode Forbids Implicit Creation Of Global Property 'csrf_token'

So, this was quite an interesting problem I have been running into. I am currently building a backb… Read more Undefined|0|ReferenceError: Strict Mode Forbids Implicit Creation Of Global Property 'csrf_token'

Stub Save Instance Method Of Mongoose Model With Sinon

I am trying to test a service function I use to save a widget using a Mongoose model. I want to stu… Read more Stub Save Instance Method Of Mongoose Model With Sinon