1. chai-things
Chai Things adds support to [Chai](http://chaijs.com/) for assertions on array elements.
chai-things
Package: chai-things
Created by: RubenVerborgh
Last modified: Mon, 13 Jun 2022 05:51:19 GMT
Version: 0.2.0
License: MIT
Downloads: 311,245
Repository: https://github.com/RubenVerborgh/Chai-Things

Install

npm install chai-things
yarn add chai-things

Chai Things

Chai Things adds support to Chai for assertions on array elements.

Example

 // Although they are equal, two different { a: 1 } objects are not the same
[{ a: 1 }, { b: 2 }].should.not.include({ a: 1 })
// However, Chai Things allows us to test what we want
[{ a: 1 }, { b: 2 }].should.include.something.that.deep.equals({ b: 2 })
// If the test fails, we get a descriptive message
[{ a: 1 }, { b: 2 }].should.include.something.that.deep.equals({ c: 3 })
/* expected an element of [ { a: 1 }, { b: 2 } ] to deeply equal { c: 3 } */

Installation and usage

 $ npm install chai-things
 var chai = require("chai");
chai.should();
chai.use(require('chai-things'));

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