You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

chai-subset-in-order

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chai-subset-in-order

Chai plugin to test matching subsets in the same order

3.1.0
latest
Source
npmnpm
Version published
Weekly downloads
3.7K
-39.2%
Maintainers
1
Weekly downloads
 
Created
Source

MIT License Build Status

NPM status

"containSubsetInOrder" object properties matcher for Chai assertion library

It works in similar way as chai-subset. However in arrays it must be the same order to pass an assertion.

Installation

npm install --save-dev chai-subset-in-order

Usage

const chai = require('chai');
const chaiSubsetInOrder = require('chai-subset-in-order');

chai.use(chaiSubsetInOrder);
const expect = chai.expect;

expect({ foo: 2, bar: 3 }).to.containSubsetInOrder({ foo: 2 });
expect({ foo: 2, bar: 3 }).to.containSubsetInOrder({ bar: 3 });
expect({ foo: 2, bar: 3 }).to.containSubsetInOrder({ foo:2, bar: 3 });
expect({ foo: 2, bar: 3 }).to.not.containSubsetInOrder({ foo: 5 });
expect([{ foo: 123, bar: 456 }, { baz: 111 }]).to.containSubsetInOrder([{ foo: 123 }]);
expect([{ foo: 123, bar: 456 }, { baz: 111 }]).to.containSubsetInOrder([{ bar: 456 }]);
expect([{ foo: 123, bar: 456 }, { baz: 111 }]).to.containSubsetInOrder([{ foo: 123 }, { baz: 111 }]);
expect([{ foo: 123, bar: 456 }, { baz: 111 }]).to.not.containSubsetInOrder([{ baz: 111 }, { foo: 123 }]);

Keywords

chai

FAQs

Package last updated on 31 May 2021

Did you know?

Socket

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