Package Exports
- jest-matcher-deep-close-to
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jest-matcher-deep-close-to) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
jest-matcher-deep-close-to
Extend jest to assert arrays and objects with approximate values.
Installation
$ npm i -D jest-matcher-deep-close-to
Usage
import {toBeDeepCloseTo,toMatchCloseTo} from 'jest-matcher-deep-close-to';
expect.extend({toBeDeepCloseTo, toMatchCloseTo});
describe('test myModule', () => {
it('should return 42', () => {
expect([42.0003]).toBeDeepCloseTo([42.0004], 3);
});
});
describe('test myModule', () => {
it('should return 42', () => {
expect({ foo: 42.0003, bar: "xxx", baz: "yyy"})
.toMatchCloseTo({ foo: 42.004, bar: "xxx" }, 3);
});
});