Skip to content

Commit

Permalink
Add a test for .keys against Lists
Browse files Browse the repository at this point in the history
  • Loading branch information
astorije committed Nov 27, 2017
1 parent f4d2e18 commit 923ed0b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ describe('chai-immutable', function () { // eslint-disable-line prefer-arrow-cal
expect(map).to.have.deep.keys({ x: 6, y: 7 });
expect(obj).to.have.keys({ x: 6, y: 7 });
expect(obj).to.have.deep.keys({ x: 6, y: 7 });
expect(new List(['x', 'y'])).to.have.all.keys({ 0: 4, 1: 5 });
});

it('should accept a Map to check against', function () { // eslint-disable-line prefer-arrow-callback
Expand Down Expand Up @@ -383,6 +384,11 @@ describe('chai-immutable', function () { // eslint-disable-line prefer-arrow-cal
);
});

it('should pass against Lists', function () { // eslint-disable-line prefer-arrow-callback
expect(new List(['x', 'y'])).to.have.all.keys(0, 1);
expect(new List(['x', 'y'])).to.have.all.keys([0, 1]);
});

it('should fail given an inexisting key', function () { // eslint-disable-line prefer-arrow-callback
fail(() => expect(new Map({ x: 1 })).to.have.key('z'));
fail(() => expect(new Map({ x: 1 })).to.have.deep.key('z'));
Expand Down

0 comments on commit 923ed0b

Please sign in to comment.