Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maasencioh/jest-matcher-deep-close-to
Extend jest to assert arrays with approximate values
https://github.com/maasencioh/jest-matcher-deep-close-to
arrays hacktoberfest jest jest-matchers jest-tests
Last synced: about 5 hours ago
JSON representation
Extend jest to assert arrays with approximate values
- Host: GitHub
- URL: https://github.com/maasencioh/jest-matcher-deep-close-to
- Owner: maasencioh
- License: mit
- Created: 2017-07-18T17:01:50.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-07T16:23:50.000Z (over 1 year ago)
- Last Synced: 2024-09-19T07:11:31.736Z (about 2 months ago)
- Topics: arrays, hacktoberfest, jest, jest-matchers, jest-tests
- Language: TypeScript
- Homepage:
- Size: 295 KB
- Stars: 36
- Watchers: 4
- Forks: 14
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# jest-matcher-deep-close-to
[![NPM version][npm-image]][npm-url]
[![build status][ci-image]][ci-url]
[![npm download][download-image]][download-url]Extend jest to assert arrays and objects with approximate values.
## Installation
`$ npm i -D jest-matcher-deep-close-to`
## Usage
```js
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);
});
});
```## License
[MIT](./LICENSE)
[npm-image]: https://img.shields.io/npm/v/jest-matcher-deep-close-to.svg
[npm-url]: https://www.npmjs.com/package/jest-matcher-deep-close-to
[ci-image]: https://github.com/maasencioh/jest-matcher-deep-close-to/workflows/Node.js%20CI/badge.svg?branch=master
[ci-url]: https://github.com/maasencioh/jest-matcher-deep-close-to/actions?query=workflow%3A%22Node.js+CI%22
[download-image]: https://img.shields.io/npm/dm/jest-matcher-deep-close-to.svg
[download-url]: https://www.npmjs.com/package/jest-matcher-deep-close-to