diff --git a/test/JSONToDate.test.js b/test/JSONToDate.test.js index d1c041a98..fc089826e 100644 --- a/test/JSONToDate.test.js +++ b/test/JSONToDate.test.js @@ -4,3 +4,6 @@ const {JSONToDate} = require('./_30s.js'); test('JSONToDate is a Function', () => { expect(JSONToDate).toBeInstanceOf(Function); }); +test('JSONToDate returns the correct date string', () => { + expect(JSONToDate(/Date(1489525200000)/)).toBe("14/3/2017"); +}); diff --git a/test/countVowels.test.js b/test/countVowels.test.js index 1b543bb8e..6d7d2c712 100644 --- a/test/countVowels.test.js +++ b/test/countVowels.test.js @@ -4,3 +4,9 @@ const {countVowels} = require('./_30s.js'); test('countVowels is a Function', () => { expect(countVowels).toBeInstanceOf(Function); }); +test('countVowels returns the correct count', () => { + expect(countVowels('foobar')).toBe(3); +}); +test('countVowels returns the correct count', () => { + expect(countVowels('ggg')).toBe(0); +}); diff --git a/test/factors.test.js b/test/factors.test.js index b02c475c1..87be84978 100644 --- a/test/factors.test.js +++ b/test/factors.test.js @@ -4,3 +4,15 @@ const {factors} = require('./_30s.js'); test('factors is a Function', () => { expect(factors).toBeInstanceOf(Function); }); +test('factors returns the correct array', () => { + expect(factors(12)).toEqual([2, 3, 4, 6, 12]); +}); +test('factors returns the correct array of primes', () => { + expect(factors(12, true)).toEqual([2, 3]); +}); +test('factors returns the correct array for negatives', () => { + expect(factors(-12)).toEqual([2, -2, 3, -3, 4, -4, 6, -6, 12, -12]); +}); +test('factors returns the correct array of primes for negatives', () => { + expect(factors(-12, true)).toEqual([2, 3]); +}); diff --git a/test/zipWith.test.js b/test/zipWith.test.js index 663be4604..95f6ccfd8 100644 --- a/test/zipWith.test.js +++ b/test/zipWith.test.js @@ -4,3 +4,9 @@ const {zipWith} = require('./_30s.js'); test('zipWith is a Function', () => { expect(zipWith).toBeInstanceOf(Function); }); +test('zipWith returns the correct results', () => { + expect(zipWith([1, 2], [10, 20], [100, 200], (a, b, c) => a + b + c)).toEqual([111, 222]); +}); +test('zipWith returns the correct results if no function is passed', () => { + expect(zipWith([1, 2], [10, 20], [100, 200])).toEqual([[1, 10, 100], [2, 20, 200]]); +});