vendredi 25 mars 2016

How to match a function with chai.should

Let say that a function should return the following

{ key: 'bar',
  cb: () => {},
  ...
}

The question is now how I can validate this in a unit test. If I do for example

getFunc().should.eql({key: 'bar', cb: () => {}, ...});

it always fails because the cb value is a different function Does Chai.should have an equivalent of jasmine.any(Function) ? or how is this done with chai.should ?

Aucun commentaire:

Enregistrer un commentaire