diff --git a/test/equals.test.js b/test/equals.test.js index dd3c64056..433462a33 100644 --- a/test/equals.test.js +++ b/test/equals.test.js @@ -21,3 +21,16 @@ test('[1,2,3] is not equal to [1,2,4]', () => { test('[1, 2, 3] should be equal to { 0: 1, 1: 2, 2: 3 }) - type is different, but their enumerable properties match.', () => { expect(equals([1, 2, 3], { 0: 1, 1: 2, 2: 3 })).toBeTruthy(); }); +const date = new Date(); +test('Two of the same date are equal', () => { + expect(equals(date, date)).toBeTruthy(); +}); +test('null should not be equal to anything', () => { + expect(equals(null, 'test')).toBeFalsy(); +}); +test('undefined should not be equal to anything', () => { + expect(equals(undefined, 'test')).toBeFalsy(); +}); +test('{a: ""} should not be equal to {a: "", b: ""}', () => { + expect(equals({a: ''}, {a: '', b: ''})).toBeFalsy(); +}); diff --git a/test/sumBy.test.js b/test/sumBy.test.js index 3fcd55f68..90523040b 100644 --- a/test/sumBy.test.js +++ b/test/sumBy.test.js @@ -4,3 +4,9 @@ const {sumBy} = require('./_30s.js'); test('sumBy is a Function', () => { expect(sumBy).toBeInstanceOf(Function); }); +test('Works with a callback.', () => { + expect(sumBy([{ n: 4 }, { n: 2 }, { n: 8 }, { n: 6 }], o => o.n)).toBe(20); +}); +test('Works with a property name.', () => { + expect(sumBy([{ n: 4 }, { n: 2 }, { n: 8 }, { n: 6 }], 'n')).toBe(20); +}); \ No newline at end of file diff --git a/test/take.test.js b/test/take.test.js index 7506eea2d..b25bbf1c0 100644 --- a/test/take.test.js +++ b/test/take.test.js @@ -10,3 +10,6 @@ test('Returns an array with n elements removed from the beginning.', () => { test('Returns an array with n elements removed from the beginning.', () => { expect(take([1, 2, 3], 0)).toEqual([]); }); +test('Returns an array with n elements removed from the beginning.', () => { + expect(take([1, 2, 3])).toEqual([1]); +}); diff --git a/test/takeWhile.test.js b/test/takeWhile.test.js index b726f5e6e..29cb6187b 100644 --- a/test/takeWhile.test.js +++ b/test/takeWhile.test.js @@ -7,3 +7,6 @@ test('takeWhile is a Function', () => { test('Removes elements until the function returns true', () => { expect(takeWhile([1, 2, 3, 4], n => n >= 3)).toEqual([1, 2]); }); +test('Removes elements until the function returns true', () => { + expect(takeWhile([1, 2, 3, 4], n => false)).toEqual([1, 2, 3, 4]); +}); diff --git a/test/timeTaken.test.js b/test/timeTaken.test.js index 72436f8b6..fc3cb21a6 100644 --- a/test/timeTaken.test.js +++ b/test/timeTaken.test.js @@ -4,3 +4,6 @@ const {timeTaken} = require('./_30s.js'); test('timeTaken is a Function', () => { expect(timeTaken).toBeInstanceOf(Function); }); +test('timeTaken is a Function', () => { + expect(timeTaken(() => 10)).toBe(10); +});