Skip to content

Commit

Permalink
Add tests to ensure giving no arguments to .keys errors
Browse files Browse the repository at this point in the history
  • Loading branch information
astorije committed Nov 27, 2017
1 parent 8d99f1a commit db3bf84
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,17 @@ describe('chai-immutable', function () { // eslint-disable-line prefer-arrow-cal
fail(() => expect(map).to.have.all.keys(new Map({ x: 1 }), 'y'), msg);
});

it('should error when given no arguments', function () { // eslint-disable-line prefer-arrow-callback
const msg = 'keys required';

fail(() => expect(map).to.have.all.keys([]), msg);
fail(() => expect(map).to.have.all.keys(new List()), msg);
fail(() => expect(map).to.have.all.keys(new Set()), msg);
fail(() => expect(map).to.have.all.keys(new Stack()), msg);
fail(() => expect(map).to.have.all.keys({}), msg);
fail(() => expect(map).to.have.all.keys(new Map()), msg);
});

it('should pass using `any` given an existing key', function () { // eslint-disable-line prefer-arrow-callback
expect(map).to.have.any.keys('x', 'z');
expect(map).to.have.any.deep.keys('x', 'z');
Expand Down

0 comments on commit db3bf84

Please sign in to comment.