jeudi 16 avril 2015

Why is this not throwing an error while testing in mocha using chai?


foos.forEach(function(foo){
expect(foo).to.have.ownProperty('stuff');
expect(foo.stuff).to.exist;
expect(foo.stuff.url).to.exist;
expect(foo).to.have.deep.property('stuff.url').to.contain('http://');
});

done();


I'm looping over a list of items foos and if one of these tests fails, it doesn't stop execution, it just hangs. For example in my the 2nd and 3rd tests were failing but I got no indication of it. Can we not use expect inside for loops? It seems to work fine when data is valid.


Aucun commentaire:

Enregistrer un commentaire