Tagged: unit testing

0

Stubbing a class without invoking a constructor

You can cre­ate Stub instances using sinon.createStubInstance. const sinon = require(‘sinon’); const Foo = require(‘../Foo.js’); const fooS­tub = sinon.createStubInstance(Foo); fooStub.foo { bar() { returns ‘bar’; } } expect(fooStub.foo.bar()).to.equal(‘bar’);

0

How to run only one test in rspec

Mostly while devel­op­ing its extremely con­ve­nient to be able to run just one par­tic­u­lar describe block or it block. Rspec lets you do that using a com­bi­na­tion of focus: true as well as adding some…