samedi 23 mai 2020

Chai deep equal on objects containing functions

How to assert deep equal between functions in chai where their toString() representation are deep equal ?

expect(() => {}).to.deep.equal(() => {}); // => should be pass


const foo = (x) => {
  // foo
  return x;
}
const bar = (x) => {
  // bar
  return x;
}
expect(foo).to.deep.equal(bar); // => should be not pass because comment makes them different

Aucun commentaire:

Enregistrer un commentaire