diff --git a/test/sample/sample.test.js b/test/sample/sample.test.js index 38902e272..199f8504b 100644 --- a/test/sample/sample.test.js +++ b/test/sample/sample.test.js @@ -1,19 +1,16 @@ const expect = require('expect'); const sample = require('./sample.js'); - - test('sample is a Function', () => { +test('sample is a Function', () => { expect(sample).toBeInstanceOf(Function); }); - const arr = [3,7,9,11]; - test('Returns a random element from the array', () => { +const arr = [3,7,9,11]; +test('Returns a random element from the array', () => { expect(arr.includes(sample(arr))).toBeTruthy(); }); - test('Works for single-element arrays', () => { - expect(sample([1]), 1).toBe() +test('Works for single-element arrays', () => { + expect(sample([1])).toBe(1); }); - test('Returns undefined for empty array', () => { - expect(sample([]), undefined).toBe() +test('Returns undefined for empty array', () => { + expect(sample([])).toBe(undefined); }); - - diff --git a/test/sampleSize/sampleSize.test.js b/test/sampleSize/sampleSize.test.js index 9edcd69c6..cebef527f 100644 --- a/test/sampleSize/sampleSize.test.js +++ b/test/sampleSize/sampleSize.test.js @@ -1,25 +1,22 @@ const expect = require('expect'); const sampleSize = require('./sampleSize.js'); - - test('sampleSize is a Function', () => { +test('sampleSize is a Function', () => { expect(sampleSize).toBeInstanceOf(Function); }); - const arr = [3,7,9,11]; - test('Returns a single element without n specified', () => { - expect(sampleSize(arr).length, 1).toBe() +const arr = [3,7,9,11]; +test('Returns a single element without n specified', () => { + expect(sampleSize(arr).length).toBe(1); }); - test('Returns a random sample of specified size from an array', () => { +test('Returns a random sample of specified size from an array', () => { expect(sampleSize(arr, 2).every(x => arr.includes(x))).toBeTruthy(); }); - test('Returns all elements in an array if n >= length', () => { - expect(sampleSize(arr, 5).length, 4).toBe() +test('Returns all elements in an array if n >= length', () => { + expect(sampleSize(arr, 5).length).toBe(4) }); - test('Returns an empty array if original array is empty', () => { - expect(sampleSize([], 2), []).toEqual() +test('Returns an empty array if original array is empty', () => { + expect(sampleSize([], 2)).toEqual([]); }); - test('Returns an empty array if n = 0', () => { - expect(sampleSize(arr, 0), []).toEqual() +test('Returns an empty array if n = 0', () => { + expect(sampleSize(arr, 0)).toEqual([]); }); - - diff --git a/test/scrollToTop/scrollToTop.test.js b/test/scrollToTop/scrollToTop.test.js index 0c44b1a53..c92677b1b 100644 --- a/test/scrollToTop/scrollToTop.test.js +++ b/test/scrollToTop/scrollToTop.test.js @@ -1,10 +1,6 @@ const expect = require('expect'); const scrollToTop = require('./scrollToTop.js'); - - test('scrollToTop is a Function', () => { +test('scrollToTop is a Function', () => { expect(scrollToTop).toBeInstanceOf(Function); }); - - - diff --git a/test/sdbm/sdbm.test.js b/test/sdbm/sdbm.test.js index 3b1156ed2..58567bc40 100644 --- a/test/sdbm/sdbm.test.js +++ b/test/sdbm/sdbm.test.js @@ -1,11 +1,9 @@ const expect = require('expect'); const sdbm = require('./sdbm.js'); - - test('sdbm is a Function', () => { +test('sdbm is a Function', () => { expect(sdbm).toBeInstanceOf(Function); }); - test('Hashes the input string into a whole number.', () => { - expect(sdbm('name')).toBe(-3521204949) +test('Hashes the input string into a whole number.', () => { + expect(sdbm('name')).toBe(-3521204949); }); - diff --git a/test/serializeCookie/serializeCookie.test.js b/test/serializeCookie/serializeCookie.test.js index c07abf4d7..211ca7c21 100644 --- a/test/serializeCookie/serializeCookie.test.js +++ b/test/serializeCookie/serializeCookie.test.js @@ -1,12 +1,9 @@ const expect = require('expect'); const serializeCookie = require('./serializeCookie.js'); - - test('serializeCookie is a Function', () => { +test('serializeCookie is a Function', () => { expect(serializeCookie).toBeInstanceOf(Function); }); - test('Serializes the cookie', () => { - expect(serializeCookie('foo', 'bar'), 'foo=bar').toBe() +test('Serializes the cookie', () => { + expect(serializeCookie('foo', 'bar')).toBe('foo=bar'); }); - - diff --git a/test/setStyle/setStyle.test.js b/test/setStyle/setStyle.test.js index 97214e8d4..92be89a6e 100644 --- a/test/setStyle/setStyle.test.js +++ b/test/setStyle/setStyle.test.js @@ -1,10 +1,6 @@ const expect = require('expect'); const setStyle = require('./setStyle.js'); - - test('setStyle is a Function', () => { +test('setStyle is a Function', () => { expect(setStyle).toBeInstanceOf(Function); -}); - - - +}); diff --git a/test/shallowClone/shallowClone.test.js b/test/shallowClone/shallowClone.test.js index d0806b0e3..fd08a3395 100644 --- a/test/shallowClone/shallowClone.test.js +++ b/test/shallowClone/shallowClone.test.js @@ -1,15 +1,12 @@ const expect = require('expect'); const shallowClone = require('./shallowClone.js'); - - test('shallowClone is a Function', () => { +test('shallowClone is a Function', () => { expect(shallowClone).toBeInstanceOf(Function); }); - const a = { foo: 'bar', obj: { a: 1, b: 2 } }; - const b = shallowClone(a); - t.notEqual(a, b, 'Shallow cloning works'); - test('Does not clone deeply', () => { - expect(a.obj, b.obj).toBe() +const a = { foo: 'bar', obj: { a: 1, b: 2 } }; +const b = shallowClone(a); +t.notEqual(a, b, 'Shallow cloning works'); +test('Does not clone deeply', () => { + expect(a.obj).toBe(b.obj); }); - - diff --git a/test/show/show.test.js b/test/show/show.test.js index 92a94c1fd..81c5ea492 100644 --- a/test/show/show.test.js +++ b/test/show/show.test.js @@ -1,10 +1,6 @@ const expect = require('expect'); const show = require('./show.js'); - - test('show is a Function', () => { +test('show is a Function', () => { expect(show).toBeInstanceOf(Function); }); - - - diff --git a/test/shuffle/shuffle.test.js b/test/shuffle/shuffle.test.js index 55914b5da..ae6630c2f 100644 --- a/test/shuffle/shuffle.test.js +++ b/test/shuffle/shuffle.test.js @@ -1,20 +1,19 @@ const expect = require('expect'); const shuffle = require('./shuffle.js'); - - test('shuffle is a Function', () => { +test('shuffle is a Function', () => { expect(shuffle).toBeInstanceOf(Function); }); - const arr = [1,2,3,4,5,6]; - t.notEqual(shuffle(arr), arr, 'Shuffles the array'); - test('New array contains all original elements', () => { +const arr = [1,2,3,4,5,6]; +test('Shuffles the array', () => { + expect(shuffle(arr)).not.toEqual(arr); +}); +test('New array contains all original elements', () => { expect(shuffle(arr).every(x => arr.includes(x))).toBeTruthy(); }); - test('Works for empty arrays', () => { - expect(shuffle([]),[]).toEqual() +test('Works for empty arrays', () => { + expect(shuffle([])).toEqual([]); }); - test('Works for single-element arrays', () => { - expect(shuffle([1]),[1]).toEqual() +test('Works for single-element arrays', () => { + expect(shuffle([1])).toEqual([1]); }); - - diff --git a/test/similarity/similarity.test.js b/test/similarity/similarity.test.js index c737f6a4b..479c64b9c 100644 --- a/test/similarity/similarity.test.js +++ b/test/similarity/similarity.test.js @@ -1,11 +1,9 @@ const expect = require('expect'); const similarity = require('./similarity.js'); - - test('similarity is a Function', () => { +test('similarity is a Function', () => { expect(similarity).toBeInstanceOf(Function); }); - test('Returns an array of elements that appear in both arrays.', () => { - expect(similarity([1, 2, 3], [1, 2, 4]), [1).toEqual(2]) +test('Returns an array of elements that appear in both arrays.', () => { + expect(similarity([1, 2, 3], [1, 2, 4])).toEqual([1, 2]); }); - diff --git a/test/size/size.test.js b/test/size/size.test.js index cb48c5517..54622aa01 100644 --- a/test/size/size.test.js +++ b/test/size/size.test.js @@ -1,14 +1,12 @@ const expect = require('expect'); const size = require('./size.js'); - - test('size is a Function', () => { +test('size is a Function', () => { expect(size).toBeInstanceOf(Function); }); - test('Get size of arrays, objects or strings.', () => { - expect(size([1, 2, 3, 4, 5])).toBe(5) +test('Get size of arrays, objects or strings.', () => { + expect(size([1, 2, 3, 4, 5])).toBe(5); }); - test('Get size of arrays, objects or strings.', () => { - expect(size({ one: 1, two: 2, three: 3 })).toBe(3) +test('Get size of arrays, objects or strings.', () => { + expect(size({ one: 1, two: 2, three: 3 })).toBe(3); }); - diff --git a/test/sleep/sleep.test.js b/test/sleep/sleep.test.js index 0996b476e..faff7c0f2 100644 --- a/test/sleep/sleep.test.js +++ b/test/sleep/sleep.test.js @@ -1,13 +1,12 @@ const expect = require('expect'); const sleep = require('./sleep.js'); - - test('sleep is a Function', () => { +test('sleep is a Function', () => { expect(sleep).toBeInstanceOf(Function); }); +test('Works as expected', () => { async function sleepyWork() { await sleep(1000); - + expect(true).toBeTruthy(); } - - +}); diff --git a/test/smoothScroll/smoothScroll.test.js b/test/smoothScroll/smoothScroll.test.js index 86f93a396..269e7252c 100644 --- a/test/smoothScroll/smoothScroll.test.js +++ b/test/smoothScroll/smoothScroll.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const smoothScroll = require('./smoothScroll.js'); - - test('smoothScroll is a Function', () => { +test('smoothScroll is a Function', () => { expect(smoothScroll).toBeInstanceOf(Function); }); - diff --git a/test/solveRPN/solveRPN.test.js b/test/solveRPN/solveRPN.test.js index ce1e02dc1..c6a2fee8b 100644 --- a/test/solveRPN/solveRPN.test.js +++ b/test/solveRPN/solveRPN.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const solveRPN = require('./solveRPN.js'); - - test('solveRPN is a Function', () => { +test('solveRPN is a Function', () => { expect(solveRPN).toBeInstanceOf(Function); }); - diff --git a/test/sortCharactersInString/sortCharactersInString.test.js b/test/sortCharactersInString/sortCharactersInString.test.js index 00084521f..8979fe2b7 100644 --- a/test/sortCharactersInString/sortCharactersInString.test.js +++ b/test/sortCharactersInString/sortCharactersInString.test.js @@ -1,11 +1,9 @@ const expect = require('expect'); const sortCharactersInString = require('./sortCharactersInString.js'); - - test('sortCharactersInString is a Function', () => { +test('sortCharactersInString is a Function', () => { expect(sortCharactersInString).toBeInstanceOf(Function); }); - test('Alphabetically sorts the characters in a string.', () => { - expect(sortCharactersInString('cabbage')).toBe('aabbceg') +test('Alphabetically sorts the characters in a string.', () => { + expect(sortCharactersInString('cabbage')).toBe('aabbceg'); }); - diff --git a/test/sortedIndex/sortedIndex.test.js b/test/sortedIndex/sortedIndex.test.js index bdf1500b8..0bfe6ff39 100644 --- a/test/sortedIndex/sortedIndex.test.js +++ b/test/sortedIndex/sortedIndex.test.js @@ -1,14 +1,12 @@ const expect = require('expect'); const sortedIndex = require('./sortedIndex.js'); - - test('sortedIndex is a Function', () => { +test('sortedIndex is a Function', () => { expect(sortedIndex).toBeInstanceOf(Function); }); - test('Returns the lowest index at which value should be inserted into array in order to maintain its sort order.', () => { - expect(sortedIndex([5, 3, 2, 1], 4)).toBe(1) +test('Returns the lowest index at which value should be inserted into array in order to maintain its sort order.', () => { + expect(sortedIndex([5, 3, 2, 1], 4)).toBe(1); }); - test('Returns the lowest index at which value should be inserted into array in order to maintain its sort order.', () => { - expect(sortedIndex([30, 50], 40)).toBe(1) +test('Returns the lowest index at which value should be inserted into array in order to maintain its sort order.', () => { + expect(sortedIndex([30, 50], 40)).toBe(1); }); - diff --git a/test/sortedIndexBy/sortedIndexBy.test.js b/test/sortedIndexBy/sortedIndexBy.test.js index 43972d8f8..6e02b36a4 100644 --- a/test/sortedIndexBy/sortedIndexBy.test.js +++ b/test/sortedIndexBy/sortedIndexBy.test.js @@ -1,12 +1,9 @@ const expect = require('expect'); const sortedIndexBy = require('./sortedIndexBy.js'); - - test('sortedIndexBy is a Function', () => { +test('sortedIndexBy is a Function', () => { expect(sortedIndexBy).toBeInstanceOf(Function); }); - test('Returns the lowest index to insert the element without messing up the list order', () => { - expect(sortedIndexBy([{ x: 4 }, { x: 5 }], { x: 4 }, o => o.x), 0).toBe() +test('Returns the lowest index to insert the element without messing up the list order', () => { + expect(sortedIndexBy([{ x: 4 }, { x: 5 }], { x: 4 }, o => o.x)).toBe(0); }); - - diff --git a/test/sortedLastIndex/sortedLastIndex.test.js b/test/sortedLastIndex/sortedLastIndex.test.js index d1c4eced1..84a9ff63a 100644 --- a/test/sortedLastIndex/sortedLastIndex.test.js +++ b/test/sortedLastIndex/sortedLastIndex.test.js @@ -1,12 +1,9 @@ const expect = require('expect'); const sortedLastIndex = require('./sortedLastIndex.js'); - - test('sortedLastIndex is a Function', () => { +test('sortedLastIndex is a Function', () => { expect(sortedLastIndex).toBeInstanceOf(Function); }); - test('Returns the highest index to insert the element without messing up the list order', () => { - expect(sortedLastIndex([10, 20, 30, 30, 40], 30), 4).toBe() +test('Returns the highest index to insert the element without messing up the list order', () => { + expect(sortedLastIndex([10, 20, 30, 30, 40], 30)).toBe(4); }); - - diff --git a/test/sortedLastIndexBy/sortedLastIndexBy.test.js b/test/sortedLastIndexBy/sortedLastIndexBy.test.js index 9cdaebb51..ad0bfc718 100644 --- a/test/sortedLastIndexBy/sortedLastIndexBy.test.js +++ b/test/sortedLastIndexBy/sortedLastIndexBy.test.js @@ -1,12 +1,9 @@ const expect = require('expect'); const sortedLastIndexBy = require('./sortedLastIndexBy.js'); - - test('sortedLastIndexBy is a Function', () => { +test('sortedLastIndexBy is a Function', () => { expect(sortedLastIndexBy).toBeInstanceOf(Function); }); - test('Returns the highest index to insert the element without messing up the list order', () => { - expect(sortedLastIndexBy([{ x: 4 }, { x: 5 }], { x: 4 }, o => o.x), 1).toBe() +test('Returns the highest index to insert the element without messing up the list order', () => { + expect(sortedLastIndexBy([{ x: 4 }, { x: 5 }], { x: 4 }, o => o.x)).toBe(1); }); - - diff --git a/test/speechSynthesis/speechSynthesis.test.js b/test/speechSynthesis/speechSynthesis.test.js index 90425aaff..9981924c8 100644 --- a/test/speechSynthesis/speechSynthesis.test.js +++ b/test/speechSynthesis/speechSynthesis.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const speechSynthesis = require('./speechSynthesis.js'); - - test('speechSynthesis is a Function', () => { +test('speechSynthesis is a Function', () => { expect(speechSynthesis).toBeInstanceOf(Function); }); - diff --git a/test/splitLines/splitLines.test.js b/test/splitLines/splitLines.test.js index a73d52de9..18a591ba3 100644 --- a/test/splitLines/splitLines.test.js +++ b/test/splitLines/splitLines.test.js @@ -1,11 +1,9 @@ const expect = require('expect'); const splitLines = require('./splitLines.js'); - - test('splitLines is a Function', () => { +test('splitLines is a Function', () => { expect(splitLines).toBeInstanceOf(Function); }); - test('Splits a multiline string into an array of lines.', () => { - expect(splitLines('This\nis a\nmultiline\nstring.\n'), ['This', 'is a', 'multiline', 'string.' ).toEqual('']) +test('Splits a multiline string into an array of lines.', () => { + expect(splitLines('This\nis a\nmultiline\nstring.\n')).toEqual(['This', 'is a', 'multiline', 'string.', '']); }); - diff --git a/test/spreadOver/spreadOver.test.js b/test/spreadOver/spreadOver.test.js index 79c471dca..7f101c1d9 100644 --- a/test/spreadOver/spreadOver.test.js +++ b/test/spreadOver/spreadOver.test.js @@ -1,12 +1,10 @@ const expect = require('expect'); const spreadOver = require('./spreadOver.js'); - - test('spreadOver is a Function', () => { +test('spreadOver is a Function', () => { expect(spreadOver).toBeInstanceOf(Function); }); - const arrayMax = spreadOver(Math.max); - test('Takes a variadic function and returns a closure that accepts an array of arguments to map to the inputs of the function.', () => { - expect(arrayMax([1, 2, 3])).toBe(3) +const arrayMax = spreadOver(Math.max); +test('Takes a variadic function and returns a closure that accepts an array of arguments to map to the inputs of the function.', () => { + expect(arrayMax([1, 2, 3])).toBe(3); }); - diff --git a/test/stableSort/stableSort.test.js b/test/stableSort/stableSort.test.js index 975e08e45..4c2f3a37b 100644 --- a/test/stableSort/stableSort.test.js +++ b/test/stableSort/stableSort.test.js @@ -1,15 +1,11 @@ const expect = require('expect'); const stableSort = require('./stableSort.js'); - - test('stableSort is a Function', () => { +test('stableSort is a Function', () => { expect(stableSort).toBeInstanceOf(Function); }); - - const arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; - const compare = () => 0; - test('Array is properly sorted', () => { - expect(stableSort(arr, compare), arr).toEqual() +const arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; +const compare = () => 0; +test('Array is properly sorted', () => { + expect(stableSort(arr, compare)).toEqual(arr); }); - - diff --git a/test/standardDeviation/standardDeviation.test.js b/test/standardDeviation/standardDeviation.test.js index 431ce662a..0bf680689 100644 --- a/test/standardDeviation/standardDeviation.test.js +++ b/test/standardDeviation/standardDeviation.test.js @@ -1,14 +1,12 @@ const expect = require('expect'); const standardDeviation = require('./standardDeviation.js'); - - test('standardDeviation is a Function', () => { +test('standardDeviation is a Function', () => { expect(standardDeviation).toBeInstanceOf(Function); }); - test('Returns the standard deviation of an array of numbers', () => { - expect(standardDeviation([10, 2, 38, 23, 38, 23, 21])).toBe(13.284434142114991) +test('Returns the standard deviation of an array of numbers', () => { + expect(standardDeviation([10, 2, 38, 23, 38, 23, 21])).toBeCloseTo(13.284434142114991,5); }); - test('Returns the standard deviation of an array of numbers', () => { - expect(standardDeviation([10, 2, 38, 23, 38, 23, 21], true)).toBe(12.29899614287479) +test('Returns the standard deviation of an array of numbers', () => { + expect(standardDeviation([10, 2, 38, 23, 38, 23, 21], true)).toBeCloseTo(12.29899614287479,5); }); - diff --git a/test/stringPermutations/stringPermutations.test.js b/test/stringPermutations/stringPermutations.test.js index 54bfb0729..f58224879 100644 --- a/test/stringPermutations/stringPermutations.test.js +++ b/test/stringPermutations/stringPermutations.test.js @@ -1,18 +1,15 @@ const expect = require('expect'); const stringPermutations = require('./stringPermutations.js'); - - test('stringPermutations is a Function', () => { +test('stringPermutations is a Function', () => { expect(stringPermutations).toBeInstanceOf(Function); }); - test('Generates all stringPermutations of a string', () => { - expect(stringPermutations('abc'), ['abc','acb','bac','bca','cab').toEqual('cba']) +test('Generates all stringPermutations of a string', () => { + expect(stringPermutations('abc'), ['abc','acb','bac','bca','cab').toEqual('cba']); }); - test('Works for single-letter strings', () => { - expect(stringPermutations('a')).toEqual(['a']) +test('Works for single-letter strings', () => { + expect(stringPermutations('a')).toEqual(['a']); }); - test('Works for empty strings', () => { - expect(stringPermutations('')).toEqual(['']) +test('Works for empty strings', () => { + expect(stringPermutations('')).toEqual(['']); }); - - diff --git a/test/stripHTMLTags/stripHTMLTags.test.js b/test/stripHTMLTags/stripHTMLTags.test.js index 225f18573..fe434e44f 100644 --- a/test/stripHTMLTags/stripHTMLTags.test.js +++ b/test/stripHTMLTags/stripHTMLTags.test.js @@ -1,12 +1,9 @@ const expect = require('expect'); const stripHTMLTags = require('./stripHTMLTags.js'); - - test('stripHTMLTags is a Function', () => { +test('stripHTMLTags is a Function', () => { expect(stripHTMLTags).toBeInstanceOf(Function); }); - test('Removes HTML tags', () => { - expect(stripHTMLTags('

lorem ipsum


'), 'lorem ipsum').toBe() +test('Removes HTML tags', () => { + expect(stripHTMLTags('

lorem ipsum


')).toBe('lorem ipsum'); }); - - diff --git a/test/sum/sum.test.js b/test/sum/sum.test.js index ba1ba0785..ac94b8891 100644 --- a/test/sum/sum.test.js +++ b/test/sum/sum.test.js @@ -1,11 +1,9 @@ const expect = require('expect'); const sum = require('./sum.js'); - - test('sum is a Function', () => { +test('sum is a Function', () => { expect(sum).toBeInstanceOf(Function); }); - test('Returns the sum of two or more numbers/arrays.', () => { - expect(sum(...[1, 2, 3, 4])).toBe(10) +test('Returns the sum of two or more numbers/arrays.', () => { + expect(sum(...[1, 2, 3, 4])).toBe(10); }); - diff --git a/test/sumBy/sumBy.test.js b/test/sumBy/sumBy.test.js index a8786d296..07e8c2b17 100644 --- a/test/sumBy/sumBy.test.js +++ b/test/sumBy/sumBy.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const sumBy = require('./sumBy.js'); - - test('sumBy is a Function', () => { +test('sumBy is a Function', () => { expect(sumBy).toBeInstanceOf(Function); }); - diff --git a/test/sumPower/sumPower.test.js b/test/sumPower/sumPower.test.js index aee0cf0a2..b655fe974 100644 --- a/test/sumPower/sumPower.test.js +++ b/test/sumPower/sumPower.test.js @@ -1,17 +1,15 @@ const expect = require('expect'); const sumPower = require('./sumPower.js'); - - test('sumPower is a Function', () => { +test('sumPower is a Function', () => { expect(sumPower).toBeInstanceOf(Function); }); - test('Returns the sum of the powers of all the numbers from start to end', () => { - expect(sumPower(10)).toBe(385) +test('Returns the sum of the powers of all the numbers from start to end', () => { + expect(sumPower(10)).toBe(385); }); - test('Returns the sum of the powers of all the numbers from start to end', () => { - expect(sumPower(10, 3)).toBe(3025) +test('Returns the sum of the powers of all the numbers from start to end', () => { + expect(sumPower(10, 3)).toBe(3025); }); - test('Returns the sum of the powers of all the numbers from start to end', () => { - expect(sumPower(10, 3, 5)).toBe(2925) +test('Returns the sum of the powers of all the numbers from start to end', () => { + expect(sumPower(10, 3, 5)).toBe(2925); }); - diff --git a/test/symmetricDifference/symmetricDifference.test.js b/test/symmetricDifference/symmetricDifference.test.js index 4084a5a1d..7fc364488 100644 --- a/test/symmetricDifference/symmetricDifference.test.js +++ b/test/symmetricDifference/symmetricDifference.test.js @@ -1,11 +1,9 @@ const expect = require('expect'); const symmetricDifference = require('./symmetricDifference.js'); - - test('symmetricDifference is a Function', () => { +test('symmetricDifference is a Function', () => { expect(symmetricDifference).toBeInstanceOf(Function); }); - test('Returns the symmetric difference between two arrays.', () => { - expect(symmetricDifference([1, 2, 3], [1, 2, 4]), [3).toEqual(4]) +test('Returns the symmetric difference between two arrays.', () => { + expect(symmetricDifference([1, 2, 3], [1, 2, 4])).toEqual([3, 4]); }); - diff --git a/test/symmetricDifferenceBy/symmetricDifferenceBy.test.js b/test/symmetricDifferenceBy/symmetricDifferenceBy.test.js index 4c3e11107..320cd8905 100644 --- a/test/symmetricDifferenceBy/symmetricDifferenceBy.test.js +++ b/test/symmetricDifferenceBy/symmetricDifferenceBy.test.js @@ -1,12 +1,9 @@ const expect = require('expect'); const symmetricDifferenceBy = require('./symmetricDifferenceBy.js'); - - test('symmetricDifferenceBy is a Function', () => { +test('symmetricDifferenceBy is a Function', () => { expect(symmetricDifferenceBy).toBeInstanceOf(Function); }); - test('Returns the symmetric difference between two arrays, after applying the provided function to each array element of both', () => { - expect(symmetricDifferenceBy([2.1, 1.2], [2.3, 3.4], Math.floor), [ 1.2, 3.4 ]).toEqual() +test('Returns the symmetric difference between two arrays, after applying the provided function to each array element of both', () => { + expect(symmetricDifferenceBy([2.1, 1.2], [2.3, 3.4], Math.floor)).toEqual([ 1.2, 3.4 ]); }); - - diff --git a/test/symmetricDifferenceWith/symmetricDifferenceWith.test.js b/test/symmetricDifferenceWith/symmetricDifferenceWith.test.js index 33f65acae..ca4920797 100644 --- a/test/symmetricDifferenceWith/symmetricDifferenceWith.test.js +++ b/test/symmetricDifferenceWith/symmetricDifferenceWith.test.js @@ -1,14 +1,12 @@ const expect = require('expect'); const symmetricDifferenceWith = require('./symmetricDifferenceWith.js'); - - test('symmetricDifferenceWith is a Function', () => { +test('symmetricDifferenceWith is a Function', () => { expect(symmetricDifferenceWith).toBeInstanceOf(Function); }); - t.deepEqual(symmetricDifferenceWith( +test('Returns the symmetric difference between two arrays, using a provided function as a comparator', () => { + expect(symmetricDifferenceWith( [1, 1.2, 1.5, 3, 0], [1.9, 3, 0, 3.9], - (a, b) => Math.round(a) === Math.round(b) -), [1, 1.2, 3.9], 'Returns the symmetric difference between two arrays, using a provided function as a comparator'); - - + (a, b) => Math.round(a) === Math.round(b))).toEqual([1, 1.2, 3.9]); +}); diff --git a/test/tail/tail.test.js b/test/tail/tail.test.js index 8c8460f64..6ed96e45c 100644 --- a/test/tail/tail.test.js +++ b/test/tail/tail.test.js @@ -1,14 +1,12 @@ const expect = require('expect'); const tail = require('./tail.js'); - - test('tail is a Function', () => { +test('tail is a Function', () => { expect(tail).toBeInstanceOf(Function); }); - test('Returns tail', () => { - expect(tail([1, 2, 3]), [2).toEqual(3]) +test('Returns tail', () => { + expect(tail([1, 2, 3]), [2).toEqual(3]); }); - test('Returns tail', () => { - expect(tail([1])).toEqual([1]) +test('Returns tail', () => { + expect(tail([1])).toEqual([1]); }); - diff --git a/test/take/take.test.js b/test/take/take.test.js index 877c1e64b..966e0ca7a 100644 --- a/test/take/take.test.js +++ b/test/take/take.test.js @@ -1,15 +1,12 @@ const expect = require('expect'); const take = require('./take.js'); - - test('take is a Function', () => { +test('take is a Function', () => { expect(take).toBeInstanceOf(Function); }); - 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], 5), [1, 2).toEqual(3]) }); - 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([]) }); - - diff --git a/test/takeRight/takeRight.test.js b/test/takeRight/takeRight.test.js index e82d8805c..2e5c1b55a 100644 --- a/test/takeRight/takeRight.test.js +++ b/test/takeRight/takeRight.test.js @@ -1,14 +1,12 @@ const expect = require('expect'); const takeRight = require('./takeRight.js'); - - test('takeRight is a Function', () => { +test('takeRight is a Function', () => { expect(takeRight).toBeInstanceOf(Function); }); - test('Returns an array with n elements removed from the end', () => { - expect(takeRight([1, 2, 3], 2), [2).toEqual(3]) +test('Returns an array with n elements removed from the end', () => { + expect(takeRight([1, 2, 3], 2)).toEqual([2, 3]); }); - test('Returns an array with n elements removed from the end', () => { +test('Returns an array with n elements removed from the end', () => { expect(takeRight([1, 2, 3])).toEqual([3]) }); - diff --git a/test/takeRightWhile/takeRightWhile.test.js b/test/takeRightWhile/takeRightWhile.test.js index 91bdd6917..9730677d9 100644 --- a/test/takeRightWhile/takeRightWhile.test.js +++ b/test/takeRightWhile/takeRightWhile.test.js @@ -1,12 +1,9 @@ const expect = require('expect'); const takeRightWhile = require('./takeRightWhile.js'); - - test('takeRightWhile is a Function', () => { +test('takeRightWhile is a Function', () => { expect(takeRightWhile).toBeInstanceOf(Function); }); - test('Removes elements until the function returns true', () => { - expect(takeRightWhile([1, 2, 3, 4], n => n < 3), [3, 4]).toEqual() +test('Removes elements until the function returns true', () => { + expect(takeRightWhile([1, 2, 3, 4], n => n < 3)).toEqual([3, 4]); }); - - diff --git a/test/takeWhile/takeWhile.test.js b/test/takeWhile/takeWhile.test.js index 0a105b25b..bdc14c586 100644 --- a/test/takeWhile/takeWhile.test.js +++ b/test/takeWhile/takeWhile.test.js @@ -1,12 +1,9 @@ const expect = require('expect'); const takeWhile = require('./takeWhile.js'); - - test('takeWhile is a Function', () => { +test('takeWhile is a Function', () => { expect(takeWhile).toBeInstanceOf(Function); }); - test('Removes elements until the function returns true', () => { - expect(takeWhile([1, 2, 3, 4], n => n >= 3), [1, 2]).toEqual() +test('Removes elements until the function returns true', () => { + expect(takeWhile([1, 2, 3, 4], n => n >= 3)).toEqual([1, 2]); }); - - diff --git a/test/throttle/throttle.test.js b/test/throttle/throttle.test.js index 31cf950fe..6f73087c6 100644 --- a/test/throttle/throttle.test.js +++ b/test/throttle/throttle.test.js @@ -1,10 +1,6 @@ const expect = require('expect'); const throttle = require('./throttle.js'); - - test('throttle is a Function', () => { +test('throttle is a Function', () => { expect(throttle).toBeInstanceOf(Function); }); - - - diff --git a/test/timeTaken/timeTaken.test.js b/test/timeTaken/timeTaken.test.js index 3782a78ee..fe67c4284 100644 --- a/test/timeTaken/timeTaken.test.js +++ b/test/timeTaken/timeTaken.test.js @@ -1,10 +1,6 @@ const expect = require('expect'); const timeTaken = require('./timeTaken.js'); - - test('timeTaken is a Function', () => { +test('timeTaken is a Function', () => { expect(timeTaken).toBeInstanceOf(Function); }); - - - diff --git a/test/times/times.test.js b/test/times/times.test.js index 6197b7cee..e5108af66 100644 --- a/test/times/times.test.js +++ b/test/times/times.test.js @@ -1,14 +1,11 @@ const expect = require('expect'); const times = require('./times.js'); - - test('times is a Function', () => { +test('times is a Function', () => { expect(times).toBeInstanceOf(Function); }); - var output = ''; - times(5, i => (output += i)); - test('Runs a function the specified amount of times', () => { - expect(output, '01234').toBe() +var output = ''; +times(5, i => (output += i)); +test('Runs a function the specified amount of times', () => { + expect(output).toBe('01234'); }); - - diff --git a/test/toCamelCase/toCamelCase.test.js b/test/toCamelCase/toCamelCase.test.js index 46b8caa2c..22b625ee8 100644 --- a/test/toCamelCase/toCamelCase.test.js +++ b/test/toCamelCase/toCamelCase.test.js @@ -1,32 +1,36 @@ const expect = require('expect'); const toCamelCase = require('./toCamelCase.js'); - - test('toCamelCase is a Function', () => { +test('toCamelCase is a Function', () => { expect(toCamelCase).toBeInstanceOf(Function); }); - test('toCamelCase('some_database_field_name') returns someDatabaseFieldName', () => { - expect(toCamelCase('some_database_field_name')).toBe('someDatabaseFieldName') +test('toCamelCase('some_database_field_name') returns someDatabaseFieldName', () => { + expect(toCamelCase('some_database_field_name')).toBe('someDatabaseFieldName'); }); - test('toCamelCase('Some label that needs to be camelized') returns someLabelThatNeedsToBeCamelized', () => { - expect(toCamelCase('Some label that needs to be camelized')).toBe('someLabelThatNeedsToBeCamelized') +test('toCamelCase('Some label that needs to be camelized') returns someLabelThatNeedsToBeCamelized', () => { + expect(toCamelCase('Some label that needs to be camelized')).toBe('someLabelThatNeedsToBeCamelized'); }); - test('toCamelCase('some-javascript-property') return someJavascriptProperty', () => { - expect(toCamelCase('some-javascript-property')).toBe('someJavascriptProperty') +test('toCamelCase('some-javascript-property') return someJavascriptProperty', () => { + expect(toCamelCase('some-javascript-property')).toBe('someJavascriptProperty'); }); - test('toCamelCase('some-mixed_string with spaces_underscores-and-hyphens') returns someMixedStringWithSpacesUnderscoresAndHyphens', () => { - expect(toCamelCase('some-mixed_string with spaces_underscores-and-hyphens')).toBe('someMixedStringWithSpacesUnderscoresAndHyphens') +test('toCamelCase('some-mixed_string with spaces_underscores-and-hyphens') returns someMixedStringWithSpacesUnderscoresAndHyphens', () => { + expect(toCamelCase('some-mixed_string with spaces_underscores-and-hyphens')).toBe('someMixedStringWithSpacesUnderscoresAndHyphens'); }); - t.throws(() => toCamelCase(), 'toCamelCase() throws a error'); - t.throws(() => toCamelCase([]), 'toCamelCase([]) throws a error'); - t.throws(() => toCamelCase({}), 'toCamelCase({}) throws a error'); - t.throws(() => toCamelCase(123), 'toCamelCase(123) throws a error'); - - let start = new Date().getTime(); - toCamelCase('some-mixed_string with spaces_underscores-and-hyphens'); - let end = new Date().getTime(); - test('toCamelCase(some-mixed_string with spaces_underscores-and-hyphens) takes less than 2s to run', () => { +test('toCamelCase() throws a error', () => { + expect(toCamelCase()).toThrow(); +}); +test('toCamelCase([]) throws a error', () => { + expect(toCamelCase([])).toThrow(); +}); +test('toCamelCase({}) throws a error', () => { + expect(toCamelCase({})).toThrow(); +}); +test('toCamelCase(123) throws a error', () => { + expect(toCamelCase(123)).toThrow(); +}); +let start = new Date().getTime(); +toCamelCase('some-mixed_string with spaces_underscores-and-hyphens'); +let end = new Date().getTime(); +test('toCamelCase(some-mixed_string with spaces_underscores-and-hyphens) takes less than 2s to run', () => { expect((end - start) < 2000).toBeTruthy(); }); - - diff --git a/test/toCurrency/toCurrency.test.js b/test/toCurrency/toCurrency.test.js index c429efcfc..81f56d85e 100644 --- a/test/toCurrency/toCurrency.test.js +++ b/test/toCurrency/toCurrency.test.js @@ -1,18 +1,15 @@ const expect = require('expect'); const toCurrency = require('./toCurrency.js'); - - test('toCurrency is a Function', () => { +test('toCurrency is a Function', () => { expect(toCurrency).toBeInstanceOf(Function); }); - test('currency: Euro | currencyLangFormat: Local', () => { - expect(toCurrency(123456.789, 'EUR'), '€ 123,456.79').toBe() +test('currency: Euro | currencyLangFormat: Local', () => { + expect(toCurrency(123456.789, 'EUR'), '€ 123,456.79').stringMatching(/€\s*123,456.79/g); }); - test(' currency: US Dollar | currencyLangFormat: English (United States)', () => { - expect(toCurrency(123456.789, 'USD', 'en-us'), '$123,456.79').toBe() +test(' currency: US Dollar | currencyLangFormat: English (United States)', () => { + expect(toCurrency(123456.789, 'USD', 'en-us')).stringMatching(/\$\s*123,456.79/g); }); - test('currency: Japanese Yen | currencyLangFormat: Local', () => { - expect(toCurrency(322342436423.2435, 'JPY'), 'JP¥ 322,342,436,423').toBe() +test('currency: Japanese Yen | currencyLangFormat: Local', () => { + expect(toCurrency(322342436423.2435, 'JPY'), 'JP¥ 322,342,436,423').stringMatching(/J*P*¥\s*322,342,436,423/g); }); - - diff --git a/test/toDecimalMark/toDecimalMark.test.js b/test/toDecimalMark/toDecimalMark.test.js index 05c4574de..017f3723c 100644 --- a/test/toDecimalMark/toDecimalMark.test.js +++ b/test/toDecimalMark/toDecimalMark.test.js @@ -1,11 +1,9 @@ const expect = require('expect'); const toDecimalMark = require('./toDecimalMark.js'); - - test('toDecimalMark is a Function', () => { +test('toDecimalMark is a Function', () => { expect(toDecimalMark).toBeInstanceOf(Function); }); - test('convert a float-point arithmetic to the Decimal mark form', () => { - expect(toDecimalMark(12305030388.9087), "12,305,030).toBe(388.909") +test('convert a float-point arithmetic to the Decimal mark form', () => { + expect(toDecimalMark(12305030388.9087)).toBe("12,305,030,388.909"); }); - diff --git a/test/toHash/toHash.test.js b/test/toHash/toHash.test.js index 662177031..27c2b4e2a 100644 --- a/test/toHash/toHash.test.js +++ b/test/toHash/toHash.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const toHash = require('./toHash.js'); - - test('toHash is a Function', () => { +test('toHash is a Function', () => { expect(toHash).toBeInstanceOf(Function); }); - diff --git a/test/toKebabCase/toKebabCase.test.js b/test/toKebabCase/toKebabCase.test.js index d59756ca0..a2ae6b202 100644 --- a/test/toKebabCase/toKebabCase.test.js +++ b/test/toKebabCase/toKebabCase.test.js @@ -1,34 +1,36 @@ const expect = require('expect'); const toKebabCase = require('./toKebabCase.js'); - - test('toKebabCase is a Function', () => { +test('toKebabCase is a Function', () => { expect(toKebabCase).toBeInstanceOf(Function); }); - test('toKebabCase('camelCase') returns camel-case', () => { - expect(toKebabCase('camelCase')).toBe('camel-case') +test('toKebabCase(\'camelCase\') returns camel-case', () => { + expect(toKebabCase('camelCase')).toBe('camel-case'); }); - test('toKebabCase('some text') returns some-text', () => { - expect(toKebabCase('some text')).toBe('some-text') +test('toKebabCase(\'some text\') returns some-text', () => { + expect(toKebabCase('some text')).toBe('some-text'); }); - test('toKebabCase('some-mixed-string With spaces-underscores-and-hyphens') returns some-mixed-string-with-spaces-underscores-and-hyphens', () => { - expect(toKebabCase('some-mixed-string With spaces-underscores-and-hyphens')).toBe('some-mixed-string-with-spaces-underscores-and-hyphens') +test('toKebabCase(\'some-mixed-string With spaces-underscores-and-hyphens\') returns some-mixed-string-with-spaces-underscores-and-hyphens', () => { + expect(toKebabCase('some-mixed-string With spaces-underscores-and-hyphens')).toBe('some-mixed-string-with-spaces-underscores-and-hyphens'); }); - test('toKebabCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML') returns i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html', () => { +test('toKebabCase(\'IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML\') returns i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html', () => { expect(toKebabCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML')).toBe('i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html') }); - test('toKebabCase() return undefined', () => { - expect(toKebabCase(), undefined).toBe() +test('toKebabCase() returns undefined', () => { + expect(toKebabCase()).toBe(undefined) }); - t.throws(() => toKebabCase([]), 'toKebabCase([]) throws an error'); - t.throws(() => toKebabCase({}), 'toKebabCase({}) throws an error'); - t.throws(() => toKebabCase(123), 'toKebabCase(123) throws an error'); - - let start = new Date().getTime(); - toKebabCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML'); - let end = new Date().getTime(); - test('toKebabCase(IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML) takes less than 2s to run', () => { +test('toKebabCase([]) throws an erro', () => { + expect(toKebabCase([])).toThrow(); +}); +test('toKebabCase({}) throws an erro', () => { + expect(toKebabCase({})).toThrow(); +}); +test('toKebabCase(123) throws an erro', () => { + expect(toKebabCase(123)).toThrow(); +}); +let start = new Date().getTime(); +toKebabCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML'); +let end = new Date().getTime(); +test('toKebabCase(IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML) takes less than 2s to run', () => { expect((end - start) < 2000).toBeTruthy(); }); - - diff --git a/test/toOrdinalSuffix/toOrdinalSuffix.test.js b/test/toOrdinalSuffix/toOrdinalSuffix.test.js index 523191f58..8bdcb11ac 100644 --- a/test/toOrdinalSuffix/toOrdinalSuffix.test.js +++ b/test/toOrdinalSuffix/toOrdinalSuffix.test.js @@ -1,20 +1,18 @@ const expect = require('expect'); const toOrdinalSuffix = require('./toOrdinalSuffix.js'); - - test('toOrdinalSuffix is a Function', () => { +test('toOrdinalSuffix is a Function', () => { expect(toOrdinalSuffix).toBeInstanceOf(Function); }); - test('Adds an ordinal suffix to a number', () => { - expect(toOrdinalSuffix('123'), '123rd').toBe() +test('Adds an ordinal suffix to a number', () => { + expect(toOrdinalSuffix('123')).toBe('123rd'); }); - test('Adds an ordinal suffix to a number', () => { - expect(toOrdinalSuffix(5), '5th').toBe() +test('Adds an ordinal suffix to a number', () => { + expect(toOrdinalSuffix(5)).toBe('5th'); }); - test('Adds an ordinal suffix to a number', () => { - expect(toOrdinalSuffix(1), '1st').toBe() +test('Adds an ordinal suffix to a number', () => { + expect(toOrdinalSuffix(1)).toBe('1st'); }); - test('Adds an ordinal suffix to a number', () => { - expect(toOrdinalSuffix(0), '0th').toBe() +test('Adds an ordinal suffix to a number', () => { + expect(toOrdinalSuffix(0)).toBe('0th'); }); - diff --git a/test/toSafeInteger/toSafeInteger.test.js b/test/toSafeInteger/toSafeInteger.test.js index 49abc7547..8362ab0e3 100644 --- a/test/toSafeInteger/toSafeInteger.test.js +++ b/test/toSafeInteger/toSafeInteger.test.js @@ -1,46 +1,42 @@ const expect = require('expect'); const toSafeInteger = require('./toSafeInteger.js'); - - test('toSafeInteger is a Function', () => { +test('toSafeInteger is a Function', () => { expect(toSafeInteger).toBeInstanceOf(Function); }); - test('Number(toSafeInteger(3.2)) is a number', () => { +test('Number(toSafeInteger(3.2)) is a number', () => { expect(Number(toSafeInteger(3.2))).toBeTruthy(); }); - test('Converts a value to a safe integer', () => { - expect(toSafeInteger(3.2)).toBe(3) +test('Converts a value to a safe integer', () => { + expect(toSafeInteger(3.2)).toBe(3); }); - test('toSafeInteger('4.2') returns 4', () => { - expect(toSafeInteger('4.2')).toBe(4) +test('toSafeInteger('4.2') returns 4', () => { + expect(toSafeInteger('4.2')).toBe(4); }); - test('toSafeInteger(4.6) returns 5', () => { - expect(toSafeInteger(4.6)).toBe(5) +test('toSafeInteger(4.6) returns 5', () => { + expect(toSafeInteger(4.6)).toBe(5); }); - test('toSafeInteger([]) returns 0', () => { - expect(toSafeInteger([])).toBe(0) +test('toSafeInteger([]) returns 0', () => { + expect(toSafeInteger([])).toBe(0); }); - test('isNaN(toSafeInteger([1.5, 3124])) is true', () => { - expect(isNaN(toSafeInteger([1.5, 3124]))).toBeTruthy() +test('isNaN(toSafeInteger([1.5, 3124])) is true', () => { + expect(isNaN(toSafeInteger([1.5, 3124]))).toBeTruthy(); }); - test('isNaN(toSafeInteger('string')) is true', () => { - expect(isNaN(toSafeInteger('string'))).toBeTruthy() +test('isNaN(toSafeInteger('string')) is true', () => { + expect(isNaN(toSafeInteger('string'))).toBeTruthy(); }); - test('isNaN(toSafeInteger({})) is true', () => { - expect(isNaN(toSafeInteger({}))).toBeTruthy() +test('isNaN(toSafeInteger({})) is true', () => { + expect(isNaN(toSafeInteger({}))).toBeTruthy(); }); - test('isNaN(toSafeInteger()) is true', () => { - expect(isNaN(toSafeInteger())).toBeTruthy() +test('isNaN(toSafeInteger()) is true', () => { + expect(isNaN(toSafeInteger())).toBeTruthy(); }); - test('toSafeInteger(Infinity) returns 9007199254740991', () => { - expect(toSafeInteger(Infinity)).toBe(9007199254740991) +test('toSafeInteger(Infinity) returns 9007199254740991', () => { + expect(toSafeInteger(Infinity)).toBe(9007199254740991); }); - - let start = new Date().getTime(); - toSafeInteger(3.2); - let end = new Date().getTime(); - test('toSafeInteger(3.2) takes less than 2s to run', () => { +let start = new Date().getTime(); +toSafeInteger(3.2); +let end = new Date().getTime(); +test('toSafeInteger(3.2) takes less than 2s to run', () => { expect((end - start) < 2000).toBeTruthy(); }); - - diff --git a/test/toSnakeCase/toSnakeCase.test.js b/test/toSnakeCase/toSnakeCase.test.js index ff0690f70..0f532f15c 100644 --- a/test/toSnakeCase/toSnakeCase.test.js +++ b/test/toSnakeCase/toSnakeCase.test.js @@ -1,34 +1,36 @@ const expect = require('expect'); const toSnakeCase = require('./toSnakeCase.js'); - - test('toSnakeCase is a Function', () => { +test('toSnakeCase is a Function', () => { expect(toSnakeCase).toBeInstanceOf(Function); }); - test('toSnakeCase('camelCase') returns camel_case', () => { - expect(toSnakeCase('camelCase')).toBe('camel_case') +test('toSnakeCase('\camelCase\') returns camel_case', () => { + expect(toSnakeCase('camelCase')).toBe('camel_case'); }); - test('toSnakeCase('some text') returns some_text', () => { - expect(toSnakeCase('some text')).toBe('some_text') +test('toSnakeCase(\'some text\') returns some_text', () => { + expect(toSnakeCase('some text')).toBe('some_text'); }); - test('toSnakeCase('some-mixed_string With spaces_underscores-and-hyphens') returns some_mixed_string_with_spaces_underscores_and_hyphens', () => { - expect(toSnakeCase('some-mixed_string With spaces_underscores-and-hyphens')).toBe('some_mixed_string_with_spaces_underscores_and_hyphens') +test('toSnakeCase(\'some-mixed_string With spaces_underscores-and-hyphens\') returns some_mixed_string_with_spaces_underscores_and_hyphens', () => { + expect(toSnakeCase('some-mixed_string With spaces_underscores-and-hyphens')).toBe('some_mixed_string_with_spaces_underscores_and_hyphens'); }); - test('toSnakeCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML') returns i_am_listening_to_fm_while_loading_different_url_on_my_browser_and_also_editing_some_xml_and_html', () => { +test('toSnakeCase(\'IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML\') returns i_am_listening_to_fm_while_loading_different_url_on_my_browser_and_also_editing_some_xml_and_html', () => { expect(toSnakeCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML')).toBe('i_am_listening_to_fm_while_loading_different_url_on_my_browser_and_also_editing_some_xml_and_html') }); - test('toSnakeCase() returns undefined', () => { - expect(toSnakeCase(), undefined).toBe() +test('toSnakeCase() returns undefined', () => { + expect(toSnakeCase()).toBe(undefined); }); - t.throws(() => toSnakeCase([]), 'toSnakeCase([]) throws an error'); - t.throws(() => toSnakeCase({}), 'toSnakeCase({}) throws an error'); - t.throws(() => toSnakeCase(123), 'toSnakeCase(123) throws an error'); - - let start = new Date().getTime(); - toSnakeCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML'); - let end = new Date().getTime(); - test('toSnakeCase(IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML) takes less than 2s to run', () => { +test('toSnakeCase([]) throws an error', () => { + expect(toSnakeCase([])).toThrow(); +}); +test('toSnakeCase({}) throws an error', () => { + expect(toSnakeCase({})).toThrow(); +}); +test('toSnakeCase(123) throws an error', () => { + expect(toSnakeCase(123)).toThrow(); +}); +let start = new Date().getTime(); +toSnakeCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML'); +let end = new Date().getTime(); +test('toSnakeCase(IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML) takes less than 2s to run', () => { expect((end - start) < 2000).toBeTruthy(); }); - - diff --git a/test/toggleClass/toggleClass.test.js b/test/toggleClass/toggleClass.test.js index 82a15fff7..7c0be8524 100644 --- a/test/toggleClass/toggleClass.test.js +++ b/test/toggleClass/toggleClass.test.js @@ -1,10 +1,6 @@ const expect = require('expect'); const toggleClass = require('./toggleClass.js'); - - test('toggleClass is a Function', () => { +test('toggleClass is a Function', () => { expect(toggleClass).toBeInstanceOf(Function); }); - - - diff --git a/test/tomorrow/tomorrow.test.js b/test/tomorrow/tomorrow.test.js index fc516576d..4827289c8 100644 --- a/test/tomorrow/tomorrow.test.js +++ b/test/tomorrow/tomorrow.test.js @@ -1,20 +1,17 @@ const expect = require('expect'); const tomorrow = require('./tomorrow.js'); - - test('tomorrow is a Function', () => { +test('tomorrow is a Function', () => { expect(tomorrow).toBeInstanceOf(Function); }); - const t1 = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() + 1); - const t2 = new Date(tomorrow()); - test('Returns the correct year', () => { - expect(t1.getFullYear(), t2.getFullYear()).toBe() +const t1 = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() + 1); +const t2 = new Date(tomorrow()); +test('Returns the correct year', () => { + expect(t1.getFullYear()).toBe(t2.getFullYear()); }); - test('Returns the correct month', () => { - expect(t1.getMonth(), t2.getMonth()).toBe() +test('Returns the correct month', () => { + expect(t1.getMonth()).toBe(t2.getMonth()); }); - test('Returns the correct date', () => { - expect(t1.getDate(), t2.getDate()).toBe() +test('Returns the correct date', () => { + expect(t1.getDate()).toBe(t2.getDate()); }); - - diff --git a/test/transform/transform.test.js b/test/transform/transform.test.js index a2407b0c6..d87d3f0c4 100644 --- a/test/transform/transform.test.js +++ b/test/transform/transform.test.js @@ -1,17 +1,14 @@ const expect = require('expect'); const transform = require('./transform.js'); - - test('transform is a Function', () => { +test('transform is a Function', () => { expect(transform).toBeInstanceOf(Function); }); - t.deepEqual(transform( +test('Transforms an object', () => { + expect(transform( { a: 1, b: 2, c: 1 }, (r, v, k) => { (r[v] || (r[v] = [])).push(k); return r; - }, - {} -), { '1': ['a', 'c'], '2': ['b'] }, 'Transforms an object'); - - + },{}).toEqual({ '1': ['a', 'c'], '2': ['b'] }); +}); diff --git a/test/truncateString/truncateString.test.js b/test/truncateString/truncateString.test.js index c3ec9db4e..bcbf57a6a 100644 --- a/test/truncateString/truncateString.test.js +++ b/test/truncateString/truncateString.test.js @@ -1,11 +1,9 @@ const expect = require('expect'); const truncateString = require('./truncateString.js'); - - test('truncateString is a Function', () => { +test('truncateString is a Function', () => { expect(truncateString).toBeInstanceOf(Function); }); - test('Truncates a "boomerang" up to a specified length.', () => { - expect(truncateString('boomerang', 7), 'boom...').toBe() +test('Truncates a "boomerang" up to a specified length.', () => { + expect(truncateString('boomerang', 7)).toBe('boom...'); }); - diff --git a/test/truthCheckCollection/truthCheckCollection.test.js b/test/truthCheckCollection/truthCheckCollection.test.js index 1c5d1a0ee..8f8c89a0a 100644 --- a/test/truthCheckCollection/truthCheckCollection.test.js +++ b/test/truthCheckCollection/truthCheckCollection.test.js @@ -1,11 +1,9 @@ const expect = require('expect'); const truthCheckCollection = require('./truthCheckCollection.js'); - - test('truthCheckCollection is a Function', () => { +test('truthCheckCollection is a Function', () => { expect(truthCheckCollection).toBeInstanceOf(Function); }); - test('second argument is truthy on all elements of a collection', () => { - expect(truthCheckCollection([{ user: 'Tinky-Winky', sex: 'male' }, { user: 'Dipsy', sex: 'male' }], 'sex')).toBe(true) +test('second argument is truthy on all elements of a collection', () => { + expect(truthCheckCollection([{ user: 'Tinky-Winky', sex: 'male' }, { user: 'Dipsy', sex: 'male' }], 'sex')).toBeTruthy(); }); -