From f8058e6d387ab1bca766393a69521a57cfd6ab6e Mon Sep 17 00:00:00 2001 From: Giampaolo Bellavite Date: Tue, 14 Feb 2017 17:43:50 -0300 Subject: [PATCH] Test not tested ifs --- test/Helpers.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/Helpers.js b/test/Helpers.js index db48929122..68fcc6fe4a 100644 --- a/test/Helpers.js +++ b/test/Helpers.js @@ -96,6 +96,14 @@ describe('Helpers', () => { expect(modifiers).to.have.length(1); expect(modifiers.indexOf('foo')).to.equal(0); }); + it('ignore falsy values', () => { + const modifiers = Helpers.getModifiersForDay( + new Date(2015, 8, 19), + { foo: null, bar: false }, + ); + expect(modifiers).to.have.length(0); + expect(modifiers.indexOf('foo')).to.equal(-1); + }); it('accepts an array of days', () => { const modifiersObj = { foo: [ @@ -123,6 +131,18 @@ describe('Helpers', () => { expect(modifiers3.indexOf('foo')).to.equal(0); expect(modifiers3.indexOf('bar')).to.equal(-1); }); + it('accepts an array of days ignoring falsy values', () => { + const values = { + foo: [ + null, + 'test', + new Date(2015, 8, 21), + ], + }; + const modifiers = Helpers.getModifiersForDay(new Date(2015, 8, 21), values); + expect(modifiers).to.have.length(1); + expect(modifiers.indexOf('foo')).to.be.above(-1); + }); it('accepts a single range of days', () => { const range = { foo: {