Tagged: unit testing

0

Stubbing a class without invoking a constructor

You can create Stub instances using sinon.createStubInstance. const sinon = require(‘sinon’); const Foo = require(‘../Foo.js’); const fooStub = 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 developing its extremely convenient to be able to run just one particular describe block or it block. Rspec lets you do that using a combination of focus: true as well as adding...