jeudi 26 janvier 2017

Deep AND Close array equality with Chai

So in Chai .deep.equals allows one to compare arrays by value and .closeTo (and .approximately) allows one to compare floats to a specified accuracy. I'm drawing a blank on how to get it to do both though i.e. test "close" equality of an array of floats e.g.

expect([0.1,0.2,0.34]).to.beDeeplyCloseTo([0.1,0.2,0.33333333]);

Thanks!

Aucun commentaire:

Enregistrer un commentaire