Socket
Socket
Sign inDemoInstall

jest-matcher-deep-close-to

Package Overview
Dependencies
13
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jest-matcher-deep-close-to

Extend jest to assert arrays with approximate values


Version published
Weekly downloads
15K
decreased by-9.07%
Maintainers
1
Install size
2.13 MB
Created
Weekly downloads
 

Changelog

Source

3.0.2 (2021-10-08)

Bug Fixes

  • package: run prepublish script in sequence (#34) (77f1dbf)

Readme

Source

jest-matcher-deep-close-to

NPM version build status npm download

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);
    });
});

License

MIT

Keywords

FAQs

Last updated on 08 Oct 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc