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

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

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'

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

How To Unit Test A Function Which Calls Another That Returns A Promise?

I have a node.js app using express 4 and this is my controller: var service = require('./catego… Read more How To Unit Test A Function Which Calls Another That Returns A Promise?

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

How Do I Assert Against Objects With Spies In Cypress?

I am using Cypress spies to test client-side analytics. My intent in this test is to confirm that … Read more How Do I Assert Against Objects With Spies In Cypress?