Jest: approximatelyDeep

Created on 18 Jul 2017  路  4Comments  路  Source: facebook/jest

This is a feature request. The idea is to have something similar to https://github.com/targos/should-approximately-deep

var a = [0.333];
expect(a).toBeDeepCloseTo([1/3], 5);

This is basically the union between toEqual and toBeCloseTo.

Most helpful comment

if actually needs something similar this was my approach

https://github.com/maasencioh/jest-matcher-deep-close-to

All 4 comments

You can write your own matchers using expect.extend. Jest is not going to provide many more matchers than the existing ones out of the box at this point, unless they provide significant value to most people using Jest.

thank you @cpojer for the quick response, then I'll do that :+1:

if actually needs something similar this was my approach

https://github.com/maasencioh/jest-matcher-deep-close-to

This is similar to supporting objects, I made a PR to add object support to your repo

Was this page helpful?
0 / 5 - 0 ratings