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

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -