Add isWeekend code snippets

This commit is contained in:
peter279k
2019-07-19 22:07:02 +08:00
parent bc0aa14697
commit ebd03958a5
3 changed files with 33 additions and 0 deletions

16
test/isWeekend.test.js Normal file
View File

@ -0,0 +1,16 @@
const {isWeekend} = require('./_30s.js');
test('isWeekend is a Function', () => {
expect(isWeekend).toBeInstanceOf(Function);
});
test('Returns the correct type', () => {
expect(typeof isWeekend()).toBe('boolean');
});
const friday = new Date('2019-07-19');
const saturday = new Date('2019-07-20');
test('Returns true', () => {
expect(isWeekend(friday)).toBe(false);
});
test('Returns false', () => {
expect(isWeekend(saturday)).toBe(true);
});