From db3bf84166e9bf102b447b6204771d879c59d1a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Astori?= Date: Mon, 27 Nov 2017 01:40:57 -0500 Subject: [PATCH] Add tests to ensure giving no arguments to `.keys` errors --- test/test.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/test.js b/test/test.js index 910a453..42c71e7 100644 --- a/test/test.js +++ b/test/test.js @@ -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');