Necessary Pigeonholing Mechanism

    chai-subset-in-order

    3.1.0 • Public • Published

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

    Install

    npm i chai-subset-in-order

    DownloadsWeekly Downloads

    1,658

    Version

    3.1.0

    License

    MIT

    Unpacked Size

    6.19 kB

    Total Files

    5

    Last publish

    Collaborators

    • oprogramador