javascript - should js assertion is wrong? -
i'm using should.js && mocha test framework build application.
i'm returning 'true' api method , found out should.js accepting true, not.
i set following test:
describe('login', function(){ it('should login , return true', function(done){ istrue().should.be.true; done(); }); }); function istrue() { return 'false'; }
and powershell + mocha result :
ps c:\dev\project> mocha --grep logi* login √ should login , return true 1 passing (27ms)
am missing something?
you forgot trigger assertion:
istrue().should.be.true(); ^--- here
if check should.js
source code see way should.be.true
fulfilled when true
(a boolean) returned (which not same 'true'
string).
assertion.add('true', function() { this.is.exactly(true); });
Comments
Post a Comment