1. chai-roughly
deep equals assertions with tolerance for chai
chai-roughly
Package: chai-roughly
Created by: Turbo87
Last modified: Mon, 13 Jun 2022 05:51:13 GMT
Version: 1.0.0
License: MIT
Downloads: 11,624
Repository: https://github.com/Turbo87/chai-roughly

Install

npm install chai-roughly
yarn add chai-roughly

chai-roughly

Build Status
Build status
npm

deep equals assertions with tolerance for chai

Installation

npm install --save-dev chai-roughly

Usage

After importing chai add the following code to use chai-roughly assertions:

 var chai = require('chai');
var expect = chai.expect;

chai.use(require('chai-roughly'));

Now you can use the expect(...).to.roughly.deep.equal(...) chain for deep
equals assertions with tolerance for numbers. The default tolerance is 1e-6
and can be overwritten by using e.g.
expect(...).to.roughly(0.001).deep.equal(...).

 it('works', function() {
  expect({ value: 42 }).to.roughly.deep.equal({ value: 41.9999999 });
});

License

chai-roughly is licensed under the MIT License.

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code