Skip to content

MemberEquals assertion #148

Closed
Closed
@NickHeiner

Description

It would be nice to assert that two arrays have the same members, regardless of order. (This would be used when we are treating arrays as sets, which aren't widely available in js yet.)

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

it('should view two arrays as equal', function() {
    expect([1, 2, 3]).to.have.same.members.as([3, 2, 1]);

    // alternate proposed syntax
    expect([1, 2, 3]).to.be.memberEqual([3, 2, 1]);
});

Can I submit a PR for this?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions