Search Posts

Category: mocha

Why does a failed assertion trigger a promise catch?

While writing unit tests for an angular app I was experiencing unexpected results. I was able to condense the unexpected behavior into a sample test. The should.equal(true, false, ‘should then’) assertion failure in the then block seems to trigger the catch block of the promise. describe.only(‘test’, function () { var $q, $rootScope; beforeEach(function () { inject(function(_$q_, _$rootScope_) { $q = _$q_; $rootScope = _$rootScope_.$new(); }); }); var stubService = sinon.stub(service, ‘getPanel’); it(‘shall…’, function() { //1 […]