Skip to content

Commit

Permalink
Test not tested ifs
Browse files Browse the repository at this point in the history
  • Loading branch information
gpbl committed Feb 14, 2017
1 parent 57ba9eb commit f8058e6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/Helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down Expand Up @@ -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: {
Expand Down

0 comments on commit f8058e6

Please sign in to comment.