From cc7b76d0b36fecb4f9aa6bd631c4c4259f10b4a9 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Fri, 3 Aug 2018 10:39:26 +0300 Subject: [PATCH] Test files linted --- test/CSVToArray/CSVToArray.test.js | 8 ++-- test/CSVToJSON/CSVToJSON.test.js | 10 +++- test/JSONtoCSV/JSONtoCSV.test.js | 8 +++- test/URLJoin/URLJoin.test.js | 8 +++- test/all/all.test.js | 16 +++---- test/any/any.test.js | 10 ++-- .../approximatelyEqual.test.js | 2 +- test/arrayToCSV/arrayToCSV.test.js | 4 +- test/attempt/attempt.test.js | 6 ++- test/average/average.test.js | 9 ++-- test/bifurcate/bifurcate.test.js | 5 +- test/bifurcateBy/bifurcateBy.test.js | 5 +- test/bindAll/bindAll.test.js | 2 +- test/byteSize/byteSize.test.js | 2 +- test/castArray/castArray.test.js | 2 +- test/chunk/chunk.test.js | 20 +++++--- test/cleanObj/cleanObj.test.js | 2 +- test/collatz/collatz.test.js | 2 +- test/collectInto/collectInto.test.js | 7 ++- test/compact/compact.test.js | 9 +++- test/compose/compose.test.js | 5 +- test/converge/converge.test.js | 7 +-- test/countBy/countBy.test.js | 4 +- .../countOccurrences/countOccurrences.test.js | 2 +- test/curry/curry.test.js | 2 +- test/debounce/debounce.test.js | 6 ++- test/deepClone/deepClone.test.js | 2 +- test/deepFlatten/deepFlatten.test.js | 2 +- test/differenceBy/differenceBy.test.js | 4 +- test/differenceWith/differenceWith.test.js | 6 ++- test/dig/dig.test.js | 24 +++++----- test/digitize/digitize.test.js | 2 +- test/drop/drop.test.js | 2 +- test/dropWhile/dropWhile.test.js | 2 +- test/elo/elo.test.js | 4 +- test/equals/equals.test.js | 6 ++- test/escapeHTML/escapeHTML.test.js | 4 +- test/everyNth/everyNth.test.js | 2 +- test/filterNonUnique/filterNonUnique.test.js | 3 +- .../filterNonUniqueBy.test.js | 44 +++++++++-------- test/findKey/findKey.test.js | 17 ++++--- test/findLastKey/findLastKey.test.js | 17 ++++--- test/flattenObject/flattenObject.test.js | 2 +- test/forEachRight/forEachRight.test.js | 2 +- test/forOwn/forOwn.test.js | 2 +- test/forOwnRight/forOwnRight.test.js | 2 +- test/formatDuration/formatDuration.test.js | 4 +- test/fromCamelCase/fromCamelCase.test.js | 4 +- test/functionName/functionName.test.js | 4 +- test/functions/functions.test.js | 2 +- test/gcd/gcd.test.js | 2 +- .../getURLParameters/getURLParameters.test.js | 5 +- test/groupBy/groupBy.test.js | 6 +-- test/hasClass/hasClass.test.js | 2 +- test/hashNode/hashNode.test.js | 4 +- test/head/head.test.js | 18 ++++--- test/httpDelete/httpDelete.js | 2 +- test/httpPut/httpPut.js | 12 ++--- test/indexOfAll/indexOfAll.test.js | 2 +- .../initialize2DArray.test.js | 2 +- .../intersectionWith/intersectionWith.test.js | 8 +++- test/invertKeyValues/invertKeyValues.test.js | 11 +++-- test/isArray/isArray.js | 2 +- test/isArrayBuffer/isArrayBuffer.js | 2 +- test/isArrayLike/isArrayLike.test.js | 2 +- test/isDivisible/isDivisible.test.js | 1 - test/isFunction/isFunction.test.js | 1 - test/isMap/isMap.js | 2 +- test/isObject/isObject.test.js | 1 - test/isPrimitive/isPrimitive.test.js | 4 +- test/isPromiseLike/isPromiseLike.test.js | 12 +++-- test/isRegExp/isRegExp.js | 2 +- test/isSet/isSet.js | 2 +- test/isSimilar/isSimilar.js | 12 +++-- test/isTravisCI/isTravisCI.test.js | 4 +- test/isTypedArray/isTypedArray.js | 2 +- test/isUpperCase/isUpperCase.test.js | 4 +- test/isWeakMap/isWeakMap.js | 2 +- test/isWeakSet/isWeakSet.js | 2 +- test/join/join.test.js | 2 +- test/last/last.test.js | 18 ++++--- .../levenshteinDistance.js | 35 ++++++++------ test/lowercaseKeys/lowercaseKeys.test.js | 2 +- test/matches/matches.test.js | 8 +++- test/matchesWith/matchesWith.test.js | 12 +++-- test/memoize/memoize.test.js | 2 +- test/merge/merge.test.js | 6 ++- test/minN/minN.test.js | 2 +- test/none/none.test.js | 8 ++-- test/nthArg/nthArg.test.js | 1 - test/objectFromPairs/objectFromPairs.test.js | 4 +- test/objectToPairs/objectToPairs.test.js | 2 +- test/omit/omit.test.js | 2 +- test/omitBy/omitBy.test.js | 2 +- test/orderBy/orderBy.test.js | 12 ++++- test/over/over.test.js | 2 +- test/pad/pad.test.js | 10 ++-- test/partition/partition.test.js | 7 ++- test/permutations/permutations.test.js | 9 +++- test/pick/pick.test.js | 2 +- test/pickBy/pickBy.test.js | 2 +- .../pipeAsyncFunctions.test.js | 15 +++--- test/prefix/prefix.test.js | 2 +- test/pull/pull.test.js | 2 +- test/pullAtIndex/pullAtIndex.test.js | 6 +-- test/pullAtValue/pullAtValue.test.js | 6 +-- test/quickSort/quickSort.test.js | 22 ++++++--- .../randomHexColorCode.test.js | 6 ++- .../randomIntArrayInRange.test.js | 6 +-- .../randomIntegerInRange.test.js | 6 +-- .../randomNumberInRange.test.js | 6 +-- .../reduceSuccessive/reduceSuccessive.test.js | 10 +++- test/reduceWhich/reduceWhich.test.js | 10 ++-- test/reducedFilter/reducedFilter.test.js | 24 +++++----- test/reject/reject.test.js | 10 +--- test/removeVowels/removeVowels.js | 2 +- test/removeVowels/removeVowels.test.js | 2 +- test/round/round.test.js | 12 ++--- .../runPromisesInSeries.test.js | 1 - test/sample/sample.test.js | 2 +- test/sampleSize/sampleSize.test.js | 2 +- test/setStyle/setStyle.test.js | 2 +- test/shuffle/shuffle.test.js | 2 +- test/splitLines/splitLines.test.js | 8 +++- .../standardDeviation.test.js | 4 +- .../stringPermutations.test.js | 2 +- test/stripHTMLTags/stripHTMLTags.test.js | 4 +- .../symmetricDifferenceBy.test.js | 2 +- .../symmetricDifferenceWith.test.js | 11 +++-- test/toCamelCase/toCamelCase.test.js | 34 ++++++++----- test/toCurrency/toCurrency.test.js | 4 +- test/toDecimalMark/toDecimalMark.test.js | 2 +- test/toKebabCase/toKebabCase.test.js | 32 +++++++++---- test/toSafeInteger/toSafeInteger.test.js | 6 +-- test/toSnakeCase/toSnakeCase.test.js | 32 +++++++++---- test/transform/transform.test.js | 16 ++++--- .../truthCheckCollection.test.js | 7 ++- test/unary/unary.test.js | 1 - test/uncurry/uncurry.test.js | 6 +-- test/unescapeHTML/unescapeHTML.test.js | 4 +- test/union/union.test.js | 34 ++++++++----- test/unionWith/unionWith.test.js | 4 +- test/uniqueElements/uniqueElements.test.js | 35 ++++++++++---- .../uniqueElementsBy/uniqueElementsBy.test.js | 48 +++++++++++-------- .../uniqueElementsByRight.test.js | 48 +++++++++++-------- test/unzip/unzip.test.js | 4 +- test/unzipWith/unzipWith.test.js | 4 +- test/when/when.test.js | 5 +- test/without/without.test.js | 24 +++++++--- test/words/words.test.js | 32 +++++++++---- test/xProd/xProd.test.js | 2 +- test/zip/zip.test.js | 9 ++-- test/zipObject/zipObject.test.js | 30 ++++++++---- 153 files changed, 754 insertions(+), 463 deletions(-) diff --git a/test/CSVToArray/CSVToArray.test.js b/test/CSVToArray/CSVToArray.test.js index dbab087d3..868ad679e 100644 --- a/test/CSVToArray/CSVToArray.test.js +++ b/test/CSVToArray/CSVToArray.test.js @@ -5,14 +5,14 @@ test('CSVToArray is a Function', () => { expect(CSVToArray).toBeInstanceOf(Function); }); test('CSVToArray works with default delimiter', () => { - expect(CSVToArray('a,b\nc,d')).toEqual([['a','b'],['c','d']]); + expect(CSVToArray('a,b\nc,d')).toEqual([['a', 'b'], ['c', 'd']]); }); test('CSVToArray works with custom delimiter', () => { - expect(CSVToArray('a;b\nc;d', ';')).toEqual([['a','b'],['c','d']]); + expect(CSVToArray('a;b\nc;d', ';')).toEqual([['a', 'b'], ['c', 'd']]); }); test('CSVToArray omits the first row', () => { - expect(CSVToArray('col1,col2\na,b\nc,d', ',', true)).toEqual([['a','b'],['c','d']]); + expect(CSVToArray('col1,col2\na,b\nc,d', ',', true)).toEqual([['a', 'b'], ['c', 'd']]); }); test('CSVToArray omits the first row and works with a custom delimiter', () => { - expect(CSVToArray('col1;col2\na;b\nc;d', ';', true)).toEqual([['a','b'],['c','d']]); + expect(CSVToArray('col1;col2\na;b\nc;d', ';', true)).toEqual([['a', 'b'], ['c', 'd']]); }); diff --git a/test/CSVToJSON/CSVToJSON.test.js b/test/CSVToJSON/CSVToJSON.test.js index be4479764..16c115bf2 100644 --- a/test/CSVToJSON/CSVToJSON.test.js +++ b/test/CSVToJSON/CSVToJSON.test.js @@ -5,8 +5,14 @@ test('CSVToJSON is a Function', () => { expect(CSVToJSON).toBeInstanceOf(Function); }); test('CSVToJSON works with default delimiter', () => { - expect(CSVToJSON('col1,col2\na,b\nc,d')).toEqual([{'col1': 'a', 'col2': 'b'}, {'col1': 'c', 'col2': 'd'}]); + expect(CSVToJSON('col1,col2\na,b\nc,d')).toEqual([ + { col1: 'a', col2: 'b' }, + { col1: 'c', col2: 'd' } + ]); }); test('CSVToJSON works with custom delimiter', () => { - expect(CSVToJSON('col1;col2\na;b\nc;d', ';')).toEqual([{'col1': 'a', 'col2': 'b'}, {'col1': 'c', 'col2': 'd'}]); + expect(CSVToJSON('col1;col2\na;b\nc;d', ';')).toEqual([ + { col1: 'a', col2: 'b' }, + { col1: 'c', col2: 'd' } + ]); }); diff --git a/test/JSONtoCSV/JSONtoCSV.test.js b/test/JSONtoCSV/JSONtoCSV.test.js index 36ec9ec2d..aed050f58 100644 --- a/test/JSONtoCSV/JSONtoCSV.test.js +++ b/test/JSONtoCSV/JSONtoCSV.test.js @@ -5,8 +5,12 @@ test('JSONtoCSV is a Function', () => { expect(JSONtoCSV).toBeInstanceOf(Function); }); test('JSONtoCSV works with default delimiter', () => { - expect(JSONtoCSV([{ a: 1, b: 2 }, { a: 3, b: 4, c: 5 }, { a: 6 }, { b: 7 }], ['a', 'b'])).toBe('a,b\n"1","2"\n"3","4"\n"6",""\n"","7"'); + expect(JSONtoCSV([{ a: 1, b: 2 }, { a: 3, b: 4, c: 5 }, { a: 6 }, { b: 7 }], ['a', 'b'])).toBe( + 'a,b\n"1","2"\n"3","4"\n"6",""\n"","7"' + ); }); test('JSONtoCSV works with custom delimiter', () => { - expect(JSONtoCSV([{ a: 1, b: 2 }, { a: 3, b: 4, c: 5 }, { a: 6 }, { b: 7 }], ['a', 'b'], ';')).toBe('a;b\n"1";"2"\n"3";"4"\n"6";""\n"";"7"'); + expect( + JSONtoCSV([{ a: 1, b: 2 }, { a: 3, b: 4, c: 5 }, { a: 6 }, { b: 7 }], ['a', 'b'], ';') + ).toBe('a;b\n"1";"2"\n"3";"4"\n"6";""\n"";"7"'); }); diff --git a/test/URLJoin/URLJoin.test.js b/test/URLJoin/URLJoin.test.js index 4e72b9363..dbc0a511b 100644 --- a/test/URLJoin/URLJoin.test.js +++ b/test/URLJoin/URLJoin.test.js @@ -5,8 +5,12 @@ test('URLJoin is a Function', () => { expect(URLJoin).toBeInstanceOf(Function); }); test('Returns proper URL', () => { - expect(URLJoin('http://www.google.com', 'a', '/b/cd', '?foo=123', '?bar=foo')).toBe('http://www.google.com/a/b/cd?foo=123&bar=foo'); + expect(URLJoin('http://www.google.com', 'a', '/b/cd', '?foo=123', '?bar=foo')).toBe( + 'http://www.google.com/a/b/cd?foo=123&bar=foo' + ); }); test('Returns proper URL', () => { - expect(URLJoin('file://www.google.com', 'a', '/b/cd', '?foo=123', '?bar=foo')).toBe('file:///www.google.com/a/b/cd?foo=123&bar=foo'); + expect(URLJoin('file://www.google.com', 'a', '/b/cd', '?foo=123', '?bar=foo')).toBe( + 'file:///www.google.com/a/b/cd?foo=123&bar=foo' + ); }); diff --git a/test/all/all.test.js b/test/all/all.test.js index 9c07329df..8e072acf6 100644 --- a/test/all/all.test.js +++ b/test/all/all.test.js @@ -5,26 +5,26 @@ test('all is a Function', () => { expect(all).toBeInstanceOf(Function); }); test('Returns true for arrays with no falsey values', () => { - expect(all([4,1,2,3])).toBeTruthy(); + expect(all([4, 1, 2, 3])).toBeTruthy(); }); test('Returns false for arrays with 0', () => { - expect(all([0,1])).toBeFalsy(); + expect(all([0, 1])).toBeFalsy(); }); test('Returns false for arrays with NaN', () => { - expect(all([NaN,1])).toBeFalsy(); + expect(all([NaN, 1])).toBeFalsy(); }); test('Returns false for arrays with undefined', () => { - expect(all([undefined,1])).toBeFalsy(); + expect(all([undefined, 1])).toBeFalsy(); }); test('Returns false for arrays with null', () => { - expect(all([null,1])).toBeFalsy(); + expect(all([null, 1])).toBeFalsy(); }); test('Returns false for arrays with empty strings', () => { - expect(all(['',1])).toBeFalsy(); + expect(all(['', 1])).toBeFalsy(); }); test('Returns true with predicate function', () => { - expect(all([4,1,2,3], x => x >= 1)).toBeTruthy(); + expect(all([4, 1, 2, 3], x => x >= 1)).toBeTruthy(); }); test('Returns false with a predicate function', () => { - expect(all([0,1], x => x >= 1)).toBeFalsy(); + expect(all([0, 1], x => x >= 1)).toBeFalsy(); }); diff --git a/test/any/any.test.js b/test/any/any.test.js index 083545c1e..003b22654 100644 --- a/test/any/any.test.js +++ b/test/any/any.test.js @@ -5,17 +5,17 @@ test('any is a Function', () => { expect(any).toBeInstanceOf(Function); }); test('Returns true for arrays with at least one truthy value', () => { - expect(any([0,1,2,3])).toBeTruthy(); + expect(any([0, 1, 2, 3])).toBeTruthy(); }); test('Returns false for arrays with no truthy values', () => { - expect(any([0,0])).toBeFalsy(); + expect(any([0, 0])).toBeFalsy(); }); test('Returns false for arrays with no truthy values', () => { - expect(any([NaN,0,undefined,null,''])).toBeFalsy(); + expect(any([NaN, 0, undefined, null, ''])).toBeFalsy(); }); test('Returns true with predicate function', () => { - expect(any([4,1,0,3], x => x >= 1)).toBeTruthy(); + expect(any([4, 1, 0, 3], x => x >= 1)).toBeTruthy(); }); test('Returns false with a predicate function', () => { - expect(any([0,1], x => x < 0)).toBeFalsy(); + expect(any([0, 1], x => x < 0)).toBeFalsy(); }); diff --git a/test/approximatelyEqual/approximatelyEqual.test.js b/test/approximatelyEqual/approximatelyEqual.test.js index 12cd74a82..462e9455f 100644 --- a/test/approximatelyEqual/approximatelyEqual.test.js +++ b/test/approximatelyEqual/approximatelyEqual.test.js @@ -5,7 +5,7 @@ test('approximatelyEqual is a Function', () => { expect(approximatelyEqual).toBeInstanceOf(Function); }); test('Works for PI / 2', () => { - expect(approximatelyEqual(Math.PI / 2.0 , 1.5708)).toBeTruthy(); + expect(approximatelyEqual(Math.PI / 2.0, 1.5708)).toBeTruthy(); }); test('Works for 0.1 + 0.2 === 0.3', () => { expect(approximatelyEqual(0.1 + 0.2, 0.3)).toBeTruthy(); diff --git a/test/arrayToCSV/arrayToCSV.test.js b/test/arrayToCSV/arrayToCSV.test.js index 7772ccff1..f45ce65b7 100644 --- a/test/arrayToCSV/arrayToCSV.test.js +++ b/test/arrayToCSV/arrayToCSV.test.js @@ -5,8 +5,8 @@ test('arrayToCSV is a Function', () => { expect(arrayToCSV).toBeInstanceOf(Function); }); test('arrayToCSV works with default delimiter', () => { - expect(arrayToCSV([['a','b'],['c','d']])).toBe('"a","b"\n"c","d"'); + expect(arrayToCSV([['a', 'b'], ['c', 'd']])).toBe('"a","b"\n"c","d"'); }); test('arrayToCSV works with custom delimiter', () => { - expect(arrayToCSV([['a','b'],['c','d']], ';')).toBe('"a";"b"\n"c";"d"'); + expect(arrayToCSV([['a', 'b'], ['c', 'd']], ';')).toBe('"a";"b"\n"c";"d"'); }); diff --git a/test/attempt/attempt.test.js b/test/attempt/attempt.test.js index 047cfd4e7..8d70bcba3 100644 --- a/test/attempt/attempt.test.js +++ b/test/attempt/attempt.test.js @@ -8,5 +8,9 @@ test('Returns a value', () => { expect(attempt(() => 0)).toBe(0); }); test('Returns an error', () => { - expect(attempt(() => {throw new Error();})).toBeInstanceOf(Error); + expect( + attempt(() => { + throw new Error(); + }) + ).toBeInstanceOf(Error); }); diff --git a/test/average/average.test.js b/test/average/average.test.js index fe042cf36..ee2a971a0 100644 --- a/test/average/average.test.js +++ b/test/average/average.test.js @@ -14,7 +14,10 @@ test('average(9, 1) returns 5', () => { expect(average(9, 1)).toBe(5); }); test('average(153, 44, 55, 64, 71, 1122, 322774, 2232, 23423, 234, 3631) returns 32163.909090909092 ', () => { - expect(average(153, 44, 55, 64, 71, 1122, 322774, 2232, 23423, 234, 3631)).toBeCloseTo(32163.909090909092, 3); + expect(average(153, 44, 55, 64, 71, 1122, 322774, 2232, 23423, 234, 3631)).toBeCloseTo( + 32163.909090909092, + 3 + ); }); test('average(1, 2, 3) returns 2', () => { expect(average(1, 2, 3)).toBe(2); @@ -29,7 +32,7 @@ test('average(String) returns NaN', () => { expect(isNaN(average('String'))).toBeTruthy(); }); test('average({ a: 123}) returns NaN', () => { - expect(isNaN(average({ a: 123}))).toBeTruthy(); + expect(isNaN(average({ a: 123 }))).toBeTruthy(); }); test('average([undefined, 0, string]) returns NaN', () => { expect(isNaN(average([undefined, 0, 'string']))).toBeTruthy(); @@ -39,5 +42,5 @@ let start = new Date().getTime(); average(153, 44, 55, 64, 71, 1122, 322774, 2232, 23423, 234, 3631); let end = new Date().getTime(); test('average([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run', () => { - expect((end - start) < 2000).toBeTruthy(); + expect(end - start < 2000).toBeTruthy(); }); diff --git a/test/bifurcate/bifurcate.test.js b/test/bifurcate/bifurcate.test.js index 456d490cb..3f00f268e 100644 --- a/test/bifurcate/bifurcate.test.js +++ b/test/bifurcate/bifurcate.test.js @@ -5,5 +5,8 @@ test('bifurcate is a Function', () => { expect(bifurcate).toBeInstanceOf(Function); }); test('Splits the collection into two groups', () => { - expect(bifurcate([ 'beep', 'boop', 'foo', 'bar' ], [ true, true, false, true ])).toEqual([ ['beep', 'boop', 'bar'], ['foo'] ]); + expect(bifurcate(['beep', 'boop', 'foo', 'bar'], [true, true, false, true])).toEqual([ + ['beep', 'boop', 'bar'], + ['foo'] + ]); }); diff --git a/test/bifurcateBy/bifurcateBy.test.js b/test/bifurcateBy/bifurcateBy.test.js index 1b01c76e7..19206aaa9 100644 --- a/test/bifurcateBy/bifurcateBy.test.js +++ b/test/bifurcateBy/bifurcateBy.test.js @@ -5,5 +5,8 @@ test('bifurcateBy is a Function', () => { expect(bifurcateBy).toBeInstanceOf(Function); }); test('Splits the collection into two groups', () => { - expect(bifurcateBy([ 'beep', 'boop', 'foo', 'bar' ], x => x[0] === 'b')).toEqual([ ['beep', 'boop', 'bar'], ['foo'] ]); + expect(bifurcateBy(['beep', 'boop', 'foo', 'bar'], x => x[0] === 'b')).toEqual([ + ['beep', 'boop', 'bar'], + ['foo'] + ]); }); diff --git a/test/bindAll/bindAll.test.js b/test/bindAll/bindAll.test.js index 8415c730c..dbbeda4a5 100644 --- a/test/bindAll/bindAll.test.js +++ b/test/bindAll/bindAll.test.js @@ -6,7 +6,7 @@ test('bindAll is a Function', () => { }); var view = { label: 'docs', - 'click': function() { + click: function() { return 'clicked ' + this.label; } }; diff --git a/test/byteSize/byteSize.test.js b/test/byteSize/byteSize.test.js index ad6371480..1199b5a3b 100644 --- a/test/byteSize/byteSize.test.js +++ b/test/byteSize/byteSize.test.js @@ -1,5 +1,5 @@ const expect = require('expect'); -const Blob = class{ +const Blob = class { constructor(s) { return { size: Buffer.byteLength(s.toString()) diff --git a/test/castArray/castArray.test.js b/test/castArray/castArray.test.js index 246a8cd48..8aa60ce18 100644 --- a/test/castArray/castArray.test.js +++ b/test/castArray/castArray.test.js @@ -11,7 +11,7 @@ test('Works for arrays with one value', () => { expect(castArray([1])).toEqual([1]); }); test('Works for arrays with multiple value', () => { - expect(castArray([1,2,3])).toEqual( [1,2,3]); + expect(castArray([1, 2, 3])).toEqual([1, 2, 3]); }); test('Works for strings', () => { expect(castArray('test')).toEqual(['test']); diff --git a/test/chunk/chunk.test.js b/test/chunk/chunk.test.js index 0509cdd6a..4025cf4ed 100644 --- a/test/chunk/chunk.test.js +++ b/test/chunk/chunk.test.js @@ -5,7 +5,7 @@ test('chunk is a Function', () => { expect(chunk).toBeInstanceOf(Function); }); test('chunk([1, 2, 3, 4, 5], 2) returns [[1,2],[3,4],[5]] ', () => { - expect(chunk([1, 2, 3, 4, 5], 2)).toEqual([[1,2],[3,4],[5]]); + expect(chunk([1, 2, 3, 4, 5], 2)).toEqual([[1, 2], [3, 4], [5]]); }); test('chunk([]) returns []', () => { expect(chunk([])).toEqual([]); @@ -14,23 +14,29 @@ test('chunk(123) returns []', () => { expect(chunk(123)).toEqual([]); }); test('chunk({ a: 123}) returns []', () => { - expect(chunk({ a: 123})).toEqual([]); + expect(chunk({ a: 123 })).toEqual([]); }); test('chunk(string, 2) returns [ st, ri, ng ]', () => { - expect(chunk('string', 2)).toEqual( [ 'st', 'ri', 'ng' ]); + expect(chunk('string', 2)).toEqual(['st', 'ri', 'ng']); }); test('chunk() throws an error', () => { - expect(() => {chunk();}).toThrow(); + expect(() => { + chunk(); + }).toThrow(); }); test('chunk(undefined) throws an error', () => { - expect(() => {chunk(undefined);}).toThrow(); + expect(() => { + chunk(undefined); + }).toThrow(); }); test('chunk(null) throws an error', () => { - expect(() => {chunk(null);}).toThrow(); + expect(() => { + chunk(null); + }).toThrow(); }); let start = new Date().getTime(); chunk('This is a string', 2); let end = new Date().getTime(); test('chunk(This is a string, 2) takes less than 2s to run', () => { - expect((end - start) < 2000).toBeTruthy(); + expect(end - start < 2000).toBeTruthy(); }); diff --git a/test/cleanObj/cleanObj.test.js b/test/cleanObj/cleanObj.test.js index b10103acb..0a9c81c6d 100644 --- a/test/cleanObj/cleanObj.test.js +++ b/test/cleanObj/cleanObj.test.js @@ -6,5 +6,5 @@ test('cleanObj is a Function', () => { }); const testObj = { a: 1, b: 2, children: { a: 1, b: 2 } }; test('Removes any properties except the ones specified from a JSON object', () => { - expect(cleanObj(testObj, ['a'], 'children')).toEqual({ a: 1, children: { a: 1}}); + expect(cleanObj(testObj, ['a'], 'children')).toEqual({ a: 1, children: { a: 1 } }); }); diff --git a/test/collatz/collatz.test.js b/test/collatz/collatz.test.js index ee2d93ff1..73ceb7886 100644 --- a/test/collatz/collatz.test.js +++ b/test/collatz/collatz.test.js @@ -12,7 +12,7 @@ test('When n is odd, times by 3 and add 1', () => { }); test('Eventually reaches 1', () => { let n = 9; - while(true) { + while (true) { if (n === 1) { expect(n).toBe(1); break; diff --git a/test/collectInto/collectInto.test.js b/test/collectInto/collectInto.test.js index fc262e1c5..a672e4515 100644 --- a/test/collectInto/collectInto.test.js +++ b/test/collectInto/collectInto.test.js @@ -9,5 +9,10 @@ let p1 = Promise.resolve(1); let p2 = Promise.resolve(2); let p3 = new Promise(resolve => setTimeout(resolve, 2000, 3)); test('Works with multiple promises', () => { - Pall(p1, p2, p3).then(function(val) { expect(val).toBe([1, 2, 3]);}, function(reason){}); + Pall(p1, p2, p3).then( + function(val) { + expect(val).toBe([1, 2, 3]); + }, + function(reason) {} + ); }); diff --git a/test/compact/compact.test.js b/test/compact/compact.test.js index 5fe0ee12e..213bfa10c 100644 --- a/test/compact/compact.test.js +++ b/test/compact/compact.test.js @@ -5,5 +5,12 @@ test('compact is a Function', () => { expect(compact).toBeInstanceOf(Function); }); test('Removes falsey values from an array', () => { - expect(compact([0, 1, false, 2, '', 3, 'a', 'e' * 23, NaN, 's', 34])).toEqual([ 1, 2, 3, 'a', 's', 34 ]); + expect(compact([0, 1, false, 2, '', 3, 'a', 'e' * 23, NaN, 's', 34])).toEqual([ + 1, + 2, + 3, + 'a', + 's', + 34 + ]); }); diff --git a/test/compose/compose.test.js b/test/compose/compose.test.js index 5da32630f..33813a409 100644 --- a/test/compose/compose.test.js +++ b/test/compose/compose.test.js @@ -6,7 +6,10 @@ test('compose is a Function', () => { }); const add5 = x => x + 5; const multiply = (x, y) => x * y; -const multiplyAndAdd5 = compose(add5, multiply); +const multiplyAndAdd5 = compose( + add5, + multiply +); test('Performs right-to-left function composition', () => { expect(multiplyAndAdd5(5, 2)).toBe(15); }); diff --git a/test/converge/converge.test.js b/test/converge/converge.test.js index 67086df48..19e2b57f0 100644 --- a/test/converge/converge.test.js +++ b/test/converge/converge.test.js @@ -6,15 +6,12 @@ test('converge is a Function', () => { }); const average = converge((a, b) => a / b, [ arr => arr.reduce((a, v) => a + v, 0), - arr => arr.length, + arr => arr.length ]); test('Produces the average of the array', () => { expect(average([1, 2, 3, 4, 5, 6, 7])).toBe(4); }); -const strangeConcat = converge((a, b) => a + b, [ - x => x.toUpperCase(), - x => x.toLowerCase()] -); +const strangeConcat = converge((a, b) => a + b, [x => x.toUpperCase(), x => x.toLowerCase()]); test('Produces the strange concatenation', () => { expect(strangeConcat('Yodel')).toBe('YODELyodel'); }); diff --git a/test/countBy/countBy.test.js b/test/countBy/countBy.test.js index a33769895..1f0c6efee 100644 --- a/test/countBy/countBy.test.js +++ b/test/countBy/countBy.test.js @@ -5,8 +5,8 @@ test('countBy is a Function', () => { expect(countBy).toBeInstanceOf(Function); }); test('Works for functions', () => { - expect(countBy([6.1, 4.2, 6.3], Math.floor)).toEqual({4: 1, 6: 2}); + expect(countBy([6.1, 4.2, 6.3], Math.floor)).toEqual({ 4: 1, 6: 2 }); }); test('Works for property names', () => { - expect(countBy(['one', 'two', 'three'], 'length')).toEqual({3: 2, 5: 1}); + expect(countBy(['one', 'two', 'three'], 'length')).toEqual({ 3: 2, 5: 1 }); }); diff --git a/test/countOccurrences/countOccurrences.test.js b/test/countOccurrences/countOccurrences.test.js index f4cfab9b4..a78b8b539 100644 --- a/test/countOccurrences/countOccurrences.test.js +++ b/test/countOccurrences/countOccurrences.test.js @@ -6,4 +6,4 @@ test('countOccurrences is a Function', () => { }); test('Counts the occurrences of a value in an array', () => { expect(countOccurrences([1, 1, 2, 1, 2, 3], 1)).toEqual(3); -}); +}); diff --git a/test/curry/curry.test.js b/test/curry/curry.test.js index 4e7b215f6..9ae220a35 100644 --- a/test/curry/curry.test.js +++ b/test/curry/curry.test.js @@ -9,4 +9,4 @@ test('curries a Math.pow', () => { }); test('curries a Math.min', () => { expect(curry(Math.min, 3)(10)(50)(2)).toBe(2); -}); +}); diff --git a/test/debounce/debounce.test.js b/test/debounce/debounce.test.js index b261f5f6d..e26209900 100644 --- a/test/debounce/debounce.test.js +++ b/test/debounce/debounce.test.js @@ -5,5 +5,7 @@ test('debounce is a Function', () => { expect(debounce).toBeInstanceOf(Function); }); test('Works as expected', () => { - debounce(() => { expect(true).toBeTruthy(); }); -}); + debounce(() => { + expect(true).toBeTruthy(); + }); +}); diff --git a/test/deepClone/deepClone.test.js b/test/deepClone/deepClone.test.js index 7fdf04e01..6983de5fc 100644 --- a/test/deepClone/deepClone.test.js +++ b/test/deepClone/deepClone.test.js @@ -6,7 +6,7 @@ test('deepClone is a Function', () => { }); const a = { foo: 'bar', obj: { a: 1, b: 2 } }; const b = deepClone(a); -const c = [{foo: "bar"}]; +const c = [{ foo: 'bar' }]; const d = deepClone(c); test('Shallow cloning works', () => { expect(a).not.toBe(b); diff --git a/test/deepFlatten/deepFlatten.test.js b/test/deepFlatten/deepFlatten.test.js index fdaa404cb..6489d26ab 100644 --- a/test/deepFlatten/deepFlatten.test.js +++ b/test/deepFlatten/deepFlatten.test.js @@ -5,5 +5,5 @@ test('deepFlatten is a Function', () => { expect(deepFlatten).toBeInstanceOf(Function); }); test('Deep flattens an array', () => { - expect(deepFlatten([1, [2], [[3], 4], 5])).toEqual( [1, 2, 3, 4, 5]); + expect(deepFlatten([1, [2], [[3], 4], 5])).toEqual([1, 2, 3, 4, 5]); }); diff --git a/test/differenceBy/differenceBy.test.js b/test/differenceBy/differenceBy.test.js index 6d312b981..cb3499833 100644 --- a/test/differenceBy/differenceBy.test.js +++ b/test/differenceBy/differenceBy.test.js @@ -5,8 +5,8 @@ test('differenceBy is a Function', () => { expect(differenceBy).toBeInstanceOf(Function); }); test('Works using a native function and numbers', () => { - expect(differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor)).toEqual( [1.2]); + expect(differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor)).toEqual([1.2]); }); test('Works with arrow function and objects', () => { - expect(differenceBy([{ x: 2 }, { x: 1 }], [{ x: 1 }], v => v.x)).toEqual([ { x: 2 } ]); + expect(differenceBy([{ x: 2 }, { x: 1 }], [{ x: 1 }], v => v.x)).toEqual([{ x: 2 }]); }); diff --git a/test/differenceWith/differenceWith.test.js b/test/differenceWith/differenceWith.test.js index 76865cce2..14b4dcff3 100644 --- a/test/differenceWith/differenceWith.test.js +++ b/test/differenceWith/differenceWith.test.js @@ -5,5 +5,7 @@ test('differenceWith is a Function', () => { expect(differenceWith).toBeInstanceOf(Function); }); test('Filters out all values from an array', () => { - expect(differenceWith([1, 1.2, 1.5, 3, 0], [1.9, 3, 0], (a, b) => Math.round(a) === Math.round(b))).toEqual([1, 1.2]); -}); + expect( + differenceWith([1, 1.2, 1.5, 3, 0], [1.9, 3, 0], (a, b) => Math.round(a) === Math.round(b)) + ).toEqual([1, 1.2]); +}); diff --git a/test/dig/dig.test.js b/test/dig/dig.test.js index d863e8e55..d47d0edf7 100644 --- a/test/dig/dig.test.js +++ b/test/dig/dig.test.js @@ -1,32 +1,32 @@ -const expect = require("expect"); -const dig = require("./dig.js"); +const expect = require('expect'); +const dig = require('./dig.js'); const data = { level1: { level2: { - level3: "some data", + level3: 'some data', level3f: false, level3a: [1, 2, 3, 4] } } }; -test("dig is a Function", () => { +test('dig is a Function', () => { expect(dig).toBeInstanceOf(Function); }); -test("Dig target success", () => { - expect(dig(data, "level3")).toEqual("some data"); +test('Dig target success', () => { + expect(dig(data, 'level3')).toEqual('some data'); }); -test("Dig target with falsey value", () => { - expect(dig(data, "level3f")).toEqual(false); +test('Dig target with falsey value', () => { + expect(dig(data, 'level3f')).toEqual(false); }); -test("Dig target with array", () => { - expect(dig(data, "level3a")).toEqual([1,2,3,4]); +test('Dig target with array', () => { + expect(dig(data, 'level3a')).toEqual([1, 2, 3, 4]); }); -test("Unknown target return undefined", () => { - expect(dig(data, "level4")).toEqual(undefined); +test('Unknown target return undefined', () => { + expect(dig(data, 'level4')).toEqual(undefined); }); diff --git a/test/digitize/digitize.test.js b/test/digitize/digitize.test.js index 9bf53102b..2feb29282 100644 --- a/test/digitize/digitize.test.js +++ b/test/digitize/digitize.test.js @@ -5,5 +5,5 @@ test('digitize is a Function', () => { expect(digitize).toBeInstanceOf(Function); }); test('Converts a number to an array of digits', () => { - expect(digitize(123)).toEqual([1, 2,3]); + expect(digitize(123)).toEqual([1, 2, 3]); }); diff --git a/test/drop/drop.test.js b/test/drop/drop.test.js index f9cc2f57b..87afd1070 100644 --- a/test/drop/drop.test.js +++ b/test/drop/drop.test.js @@ -5,7 +5,7 @@ test('drop is a Function', () => { expect(drop).toBeInstanceOf(Function); }); test('Works without the last argument', () => { - expect(drop([1, 2, 3])).toEqual([2,3]); + expect(drop([1, 2, 3])).toEqual([2, 3]); }); test('Removes appropriate element count as specified', () => { expect(drop([1, 2, 3], 2)).toEqual([3]); diff --git a/test/dropWhile/dropWhile.test.js b/test/dropWhile/dropWhile.test.js index 19aa31470..40c0f0987 100644 --- a/test/dropWhile/dropWhile.test.js +++ b/test/dropWhile/dropWhile.test.js @@ -5,5 +5,5 @@ test('dropWhile is a Function', () => { expect(dropWhile).toBeInstanceOf(Function); }); test('Removes elements in an array until the passed function returns true.', () => { - expect(dropWhile([1, 2, 3, 4], n => n >= 3)).toEqual([3,4]); + expect(dropWhile([1, 2, 3, 4], n => n >= 3)).toEqual([3, 4]); }); diff --git a/test/elo/elo.test.js b/test/elo/elo.test.js index a5e146384..042dad3d4 100644 --- a/test/elo/elo.test.js +++ b/test/elo/elo.test.js @@ -5,9 +5,9 @@ test('elo is a Function', () => { expect(elo).toBeInstanceOf(Function); }); test('Standard 1v1s', () => { - expect(elo([1200, 1200])).toEqual([1216,1184]); + expect(elo([1200, 1200])).toEqual([1216, 1184]); }); -test('Standard 1v1s' ,() => { +test('Standard 1v1s', () => { expect(elo([1200, 1200], 64)).toEqual([1232, 1168]); }); test('4 player FFA, all same rank', () => { diff --git a/test/equals/equals.test.js b/test/equals/equals.test.js index 4d40b9b63..2f89886ec 100644 --- a/test/equals/equals.test.js +++ b/test/equals/equals.test.js @@ -4,8 +4,10 @@ const equals = require('./equals.js'); test('equals is a Function', () => { expect(equals).toBeInstanceOf(Function); }); -test('{ a: [2, {e: 3}], b: [4], c: \'foo\' } is equal to { a: [2, {e: 3}], b: [4], c: \'foo\' }', () => { - expect(equals({ a: [2, {e: 3}], b: [4], c: 'foo' }, { a: [2, {e: 3}], b: [4], c: 'foo' })).toBeTruthy(); +test("{ a: [2, {e: 3}], b: [4], c: 'foo' } is equal to { a: [2, {e: 3}], b: [4], c: 'foo' }", () => { + expect( + equals({ a: [2, { e: 3 }], b: [4], c: 'foo' }, { a: [2, { e: 3 }], b: [4], c: 'foo' }) + ).toBeTruthy(); }); test('[1,2,3] is equal to [1,2,3]', () => { expect(equals([1, 2, 3], [1, 2, 3])).toBeTruthy(); diff --git a/test/escapeHTML/escapeHTML.test.js b/test/escapeHTML/escapeHTML.test.js index 1865b7cd8..e824acf9b 100644 --- a/test/escapeHTML/escapeHTML.test.js +++ b/test/escapeHTML/escapeHTML.test.js @@ -5,5 +5,7 @@ test('escapeHTML is a Function', () => { expect(escapeHTML).toBeInstanceOf(Function); }); test('Escapes a string for use in HTML', () => { - expect(escapeHTML('Me & you')).toBe('<a href="#">Me & you</a>'); + expect(escapeHTML('Me & you')).toBe( + '<a href="#">Me & you</a>' + ); }); diff --git a/test/everyNth/everyNth.test.js b/test/everyNth/everyNth.test.js index b54958fc7..826f746cf 100644 --- a/test/everyNth/everyNth.test.js +++ b/test/everyNth/everyNth.test.js @@ -5,5 +5,5 @@ test('everyNth is a Function', () => { expect(everyNth).toBeInstanceOf(Function); }); test('Returns every nth element in an array', () => { - expect(everyNth([1, 2, 3, 4, 5, 6], 2)).toEqual([ 2, 4, 6 ]); + expect(everyNth([1, 2, 3, 4, 5, 6], 2)).toEqual([2, 4, 6]); }); diff --git a/test/filterNonUnique/filterNonUnique.test.js b/test/filterNonUnique/filterNonUnique.test.js index b4ab55867..288d0209a 100644 --- a/test/filterNonUnique/filterNonUnique.test.js +++ b/test/filterNonUnique/filterNonUnique.test.js @@ -5,6 +5,5 @@ test('filterNonUnique is a Function', () => { expect(filterNonUnique).toBeInstanceOf(Function); }); test('Filters out the non-unique values in an array', () => { - expect(filterNonUnique([1, 2, 2, 3, 4, 4, 5])).toEqual([1,3, 5]); + expect(filterNonUnique([1, 2, 2, 3, 4, 4, 5])).toEqual([1, 3, 5]); }); - diff --git a/test/filterNonUniqueBy/filterNonUniqueBy.test.js b/test/filterNonUniqueBy/filterNonUniqueBy.test.js index a5e33a37e..c5b150049 100644 --- a/test/filterNonUniqueBy/filterNonUniqueBy.test.js +++ b/test/filterNonUniqueBy/filterNonUniqueBy.test.js @@ -6,27 +6,31 @@ test('filterNonUniqueBy is a Function', () => { }); test('filterNonUniqueBy works for properties', () => { - expect(filterNonUniqueBy( - [ - { id: 0, value: 'a' }, - { id: 1, value: 'b' }, - { id: 2, value: 'c' }, - { id: 1, value: 'd' }, - { id: 0, value: 'e' }, - ], - (a, b) => a.id === b.id - )).toEqual([ { id: 2, value: 'c' } ]); + expect( + filterNonUniqueBy( + [ + { id: 0, value: 'a' }, + { id: 1, value: 'b' }, + { id: 2, value: 'c' }, + { id: 1, value: 'd' }, + { id: 0, value: 'e' } + ], + (a, b) => a.id === b.id + ) + ).toEqual([{ id: 2, value: 'c' }]); }); test('filterNonUniqueBy works for nested properties', () => { - expect(filterNonUniqueBy( - [ - { id: 0, value: 'a', n: {p: 0} }, - { id: 1, value: 'b', n: {p: 1} }, - { id: 2, value: 'c', n: {p: 2} }, - { id: 1, value: 'd', n: {p: 0} }, - { id: 0, value: 'e', n: {p: 1} }, - ], - (a, b) => a.id === b.id - )).toEqual([ { id: 2, value: 'c', n: {p: 2} } ]); + expect( + filterNonUniqueBy( + [ + { id: 0, value: 'a', n: { p: 0 } }, + { id: 1, value: 'b', n: { p: 1 } }, + { id: 2, value: 'c', n: { p: 2 } }, + { id: 1, value: 'd', n: { p: 0 } }, + { id: 0, value: 'e', n: { p: 1 } } + ], + (a, b) => a.id === b.id + ) + ).toEqual([{ id: 2, value: 'c', n: { p: 2 } }]); }); diff --git a/test/findKey/findKey.test.js b/test/findKey/findKey.test.js index 54dcc5d33..da13fb698 100644 --- a/test/findKey/findKey.test.js +++ b/test/findKey/findKey.test.js @@ -5,11 +5,14 @@ test('findKey is a Function', () => { expect(findKey).toBeInstanceOf(Function); }); test('Returns the appropriate key', () => { - expect(findKey( - { - barney: { age: 36, active: true }, - fred: { age: 40, active: false }, - pebbles: { age: 1, active: true } - }, - o => o['active'])).toBe('barney'); + expect( + findKey( + { + barney: { age: 36, active: true }, + fred: { age: 40, active: false }, + pebbles: { age: 1, active: true } + }, + o => o['active'] + ) + ).toBe('barney'); }); diff --git a/test/findLastKey/findLastKey.test.js b/test/findLastKey/findLastKey.test.js index 434e3e031..d2e910b2c 100644 --- a/test/findLastKey/findLastKey.test.js +++ b/test/findLastKey/findLastKey.test.js @@ -5,11 +5,14 @@ test('findLastKey is a Function', () => { expect(findLastKey).toBeInstanceOf(Function); }); test('eturns the appropriate key', () => { - expect(findLastKey( - { - barney: { age: 36, active: true }, - fred: { age: 40, active: false }, - pebbles: { age: 1, active: true } - }, - o => o['active'])).toBe('pebbles'); + expect( + findLastKey( + { + barney: { age: 36, active: true }, + fred: { age: 40, active: false }, + pebbles: { age: 1, active: true } + }, + o => o['active'] + ) + ).toBe('pebbles'); }); diff --git a/test/flattenObject/flattenObject.test.js b/test/flattenObject/flattenObject.test.js index 8ccafaf3e..e1d845c5d 100644 --- a/test/flattenObject/flattenObject.test.js +++ b/test/flattenObject/flattenObject.test.js @@ -8,5 +8,5 @@ test('Flattens an object with the paths for keys', () => { expect(flattenObject({ a: { b: { c: 1 } }, d: 1 })).toEqual({ 'a.b.c': 1, d: 1 }); }); test('Works with arrays', () => { - expect(flattenObject([0,1,[2,[1]],1])).toEqual({ 0: 0, 1: 1, 3: 1, '2.0': 2, '2.1.0': 1 }); + expect(flattenObject([0, 1, [2, [1]], 1])).toEqual({ 0: 0, 1: 1, 3: 1, '2.0': 2, '2.1.0': 1 }); }); diff --git a/test/forEachRight/forEachRight.test.js b/test/forEachRight/forEachRight.test.js index e137a68e2..aec112662 100644 --- a/test/forEachRight/forEachRight.test.js +++ b/test/forEachRight/forEachRight.test.js @@ -5,7 +5,7 @@ test('forEachRight is a Function', () => { expect(forEachRight).toBeInstanceOf(Function); }); let output = ''; -forEachRight([1, 2, 3, 4], val => output+=val); +forEachRight([1, 2, 3, 4], val => (output += val)); test('Iterates over the array in reverse', () => { expect(output).toBe('4321'); }); diff --git a/test/forOwn/forOwn.test.js b/test/forOwn/forOwn.test.js index 74c408c62..54f598cd0 100644 --- a/test/forOwn/forOwn.test.js +++ b/test/forOwn/forOwn.test.js @@ -6,6 +6,6 @@ test('forOwn is a Function', () => { }); let output = []; forOwn({ foo: 'bar', a: 1 }, v => output.push(v)); -test('Iterates over an element\'s key-value pairs', () => { +test("Iterates over an element's key-value pairs", () => { expect(output).toEqual(['bar', 1]); }); diff --git a/test/forOwnRight/forOwnRight.test.js b/test/forOwnRight/forOwnRight.test.js index 781d287fe..542743af7 100644 --- a/test/forOwnRight/forOwnRight.test.js +++ b/test/forOwnRight/forOwnRight.test.js @@ -6,6 +6,6 @@ test('forOwnRight is a Function', () => { }); let output = []; forOwnRight({ foo: 'bar', a: 1 }, v => output.push(v)); -test('Iterates over an element\'s key-value pairs in reverse', () => { +test("Iterates over an element's key-value pairs in reverse", () => { expect(output).toEqual([1, 'bar']); }); diff --git a/test/formatDuration/formatDuration.test.js b/test/formatDuration/formatDuration.test.js index 780ffae26..e1514868d 100644 --- a/test/formatDuration/formatDuration.test.js +++ b/test/formatDuration/formatDuration.test.js @@ -8,5 +8,7 @@ test('Returns the human readable format of the given number of milliseconds', () expect(formatDuration(1001)).toBe('1 second, 1 millisecond'); }); test('Returns the human readable format of the given number of milliseconds', () => { - expect(formatDuration(34325055574)).toBe('397 days, 6 hours, 44 minutes, 15 seconds, 574 milliseconds'); + expect(formatDuration(34325055574)).toBe( + '397 days, 6 hours, 44 minutes, 15 seconds, 574 milliseconds' + ); }); diff --git a/test/fromCamelCase/fromCamelCase.test.js b/test/fromCamelCase/fromCamelCase.test.js index 5491058ac..28a067ebf 100644 --- a/test/fromCamelCase/fromCamelCase.test.js +++ b/test/fromCamelCase/fromCamelCase.test.js @@ -8,7 +8,9 @@ test('Converts a string from camelcase', () => { expect(fromCamelCase('someDatabaseFieldName', ' ')).toBe('some database field name'); }); test('Converts a string from camelcase', () => { - expect(fromCamelCase('someLabelThatNeedsToBeCamelized', '-')).toBe('some-label-that-needs-to-be-camelized'); + expect(fromCamelCase('someLabelThatNeedsToBeCamelized', '-')).toBe( + 'some-label-that-needs-to-be-camelized' + ); }); test('Converts a string from camelcase', () => { expect(fromCamelCase('someJavascriptProperty', '_')).toBe('some_javascript_property'); diff --git a/test/functionName/functionName.test.js b/test/functionName/functionName.test.js index 91c75a6a4..681acdcba 100644 --- a/test/functionName/functionName.test.js +++ b/test/functionName/functionName.test.js @@ -8,7 +8,9 @@ test('functionName is a Function', () => { test('Works for native functions', () => { expect(functionName(Math.max)).toBe('max'); }); -function fun(x) {return x;} +function fun(x) { + return x; +} test('Works for functions', () => { expect(functionName(fun)).toBe('fun'); }); diff --git a/test/functions/functions.test.js b/test/functions/functions.test.js index b7193bf92..92db006c1 100644 --- a/test/functions/functions.test.js +++ b/test/functions/functions.test.js @@ -10,7 +10,7 @@ function Foo() { } Foo.prototype.c = () => 3; test('Returns own methods', () => { - expect(functions(new Foo())).toEqual( ['a', 'b']); + expect(functions(new Foo())).toEqual(['a', 'b']); }); test('Returns own and inherited methods', () => { expect(functions(new Foo(), true)).toEqual(['a', 'b', 'c']); diff --git a/test/gcd/gcd.test.js b/test/gcd/gcd.test.js index 8657042d6..0cb8d930a 100644 --- a/test/gcd/gcd.test.js +++ b/test/gcd/gcd.test.js @@ -9,4 +9,4 @@ test('Calculates the greatest common divisor between two or more numbers/arrays' }); test('Calculates the greatest common divisor between two or more numbers/arrays', () => { expect(gcd(...[12, 8, 32])).toEqual(4); -}); +}); diff --git a/test/getURLParameters/getURLParameters.test.js b/test/getURLParameters/getURLParameters.test.js index f23854b52..baf391631 100644 --- a/test/getURLParameters/getURLParameters.test.js +++ b/test/getURLParameters/getURLParameters.test.js @@ -5,5 +5,8 @@ test('getURLParameters is a Function', () => { expect(getURLParameters).toBeInstanceOf(Function); }); test('Returns an object containing the parameters of the current URL', () => { - expect(getURLParameters('http://url.com/page?name=Adam&surname=Smith')).toEqual({name: 'Adam', surname: 'Smith'}); + expect(getURLParameters('http://url.com/page?name=Adam&surname=Smith')).toEqual({ + name: 'Adam', + surname: 'Smith' + }); }); diff --git a/test/groupBy/groupBy.test.js b/test/groupBy/groupBy.test.js index 7f1c61eae..de3d0560b 100644 --- a/test/groupBy/groupBy.test.js +++ b/test/groupBy/groupBy.test.js @@ -5,8 +5,8 @@ test('groupBy is a Function', () => { expect(groupBy).toBeInstanceOf(Function); }); test('Groups the elements of an array based on the given function', () => { - expect(groupBy([6.1, 4.2, 6.3], Math.floor)).toEqual({4: [4.2], 6: [6.1, 6.3]}); + expect(groupBy([6.1, 4.2, 6.3], Math.floor)).toEqual({ 4: [4.2], 6: [6.1, 6.3] }); }); test('Groups the elements of an array based on the given function', () => { - expect(groupBy(['one', 'two', 'three'], 'length')).toEqual({3: ['one', 'two'], 5: ['three']}); -}); + expect(groupBy(['one', 'two', 'three'], 'length')).toEqual({ 3: ['one', 'two'], 5: ['three'] }); +}); diff --git a/test/hasClass/hasClass.test.js b/test/hasClass/hasClass.test.js index 74198e04e..cd8fc69c7 100644 --- a/test/hasClass/hasClass.test.js +++ b/test/hasClass/hasClass.test.js @@ -3,4 +3,4 @@ const hasClass = require('./hasClass.js'); test('hasClass is a Function', () => { expect(hasClass).toBeInstanceOf(Function); -}); +}); diff --git a/test/hashNode/hashNode.test.js b/test/hashNode/hashNode.test.js index 250701418..6cf659be2 100644 --- a/test/hashNode/hashNode.test.js +++ b/test/hashNode/hashNode.test.js @@ -5,5 +5,7 @@ test('hashNode is a Function', () => { expect(hashNode).toBeInstanceOf(Function); }); test('Produces the appropriate hash', () => { - hashNode(JSON.stringify({ a: 'a', b: [1, 2, 3, 4], foo: { c: 'bar' } })).then(v => expect(v).toBe('04aa106279f5977f59f9067fa9712afc4aedc6f5862a8defc34552d8c7206393')); + hashNode(JSON.stringify({ a: 'a', b: [1, 2, 3, 4], foo: { c: 'bar' } })).then(v => + expect(v).toBe('04aa106279f5977f59f9067fa9712afc4aedc6f5862a8defc34552d8c7206393') + ); }); diff --git a/test/head/head.test.js b/test/head/head.test.js index ec707eb30..4330a382a 100644 --- a/test/head/head.test.js +++ b/test/head/head.test.js @@ -5,29 +5,35 @@ test('head is a Function', () => { expect(head).toBeInstanceOf(Function); }); test('head({ a: 1234}) returns undefined', () => { - expect(head({ a: 1234}) === undefined).toBeTruthy(); + expect(head({ a: 1234 }) === undefined).toBeTruthy(); }); test('head([1, 2, 3]) returns 1', () => { expect(head([1, 2, 3])).toBe(1); }); test('head({ 0: false}) returns false', () => { - expect(head({ 0: false})).toBeFalsy(); + expect(head({ 0: false })).toBeFalsy(); }); test('head(String) returns S', () => { expect(head('String')).toBe('S'); }); test('head(null) throws an Error', () => { - expect(() => { head(null); }).toThrow(); + expect(() => { + head(null); + }).toThrow(); }); test('head(undefined) throws an Error', () => { - expect(() => { head(undefined); }).toThrow(); + expect(() => { + head(undefined); + }).toThrow(); }); test('head() throws an Error', () => { - expect(() => { head(); }).toThrow(); + expect(() => { + head(); + }).toThrow(); }); let start = new Date().getTime(); head([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]); let end = new Date().getTime(); test('head([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run', () => { - expect((end - start) < 2000).toBeTruthy(); + expect(end - start < 2000).toBeTruthy(); }); diff --git a/test/httpDelete/httpDelete.js b/test/httpDelete/httpDelete.js index 2a2d55a28..5b86d324a 100644 --- a/test/httpDelete/httpDelete.js +++ b/test/httpDelete/httpDelete.js @@ -1,6 +1,6 @@ const httpDelete = (url, callback, err = console.error) => { const request = new XMLHttpRequest(); - request.open("DELETE", url, true); + request.open('DELETE', url, true); request.onload = () => callback(request); request.onerror = () => err(request); request.send(); diff --git a/test/httpPut/httpPut.js b/test/httpPut/httpPut.js index 9c34ca2d0..4b3e02701 100644 --- a/test/httpPut/httpPut.js +++ b/test/httpPut/httpPut.js @@ -1,9 +1,9 @@ const httpPut = (url, data, callback, err = console.error) => { - const request = new XMLHttpRequest(); - request.open("PUT", url, true); - request.setRequestHeader('Content-type','application/json; charset=utf-8'); - request.onload = () => callback(request); - request.onerror = () => err(request); - request.send(data); + const request = new XMLHttpRequest(); + request.open('PUT', url, true); + request.setRequestHeader('Content-type', 'application/json; charset=utf-8'); + request.onload = () => callback(request); + request.onerror = () => err(request); + request.send(data); }; module.exports = httpPut; diff --git a/test/indexOfAll/indexOfAll.test.js b/test/indexOfAll/indexOfAll.test.js index 0747df466..e62fc50f9 100644 --- a/test/indexOfAll/indexOfAll.test.js +++ b/test/indexOfAll/indexOfAll.test.js @@ -5,7 +5,7 @@ test('indexOfAll is a Function', () => { expect(indexOfAll).toBeInstanceOf(Function); }); test('Returns all indices of val in an array', () => { - expect(indexOfAll([1, 2, 3, 1, 2, 3], 1)).toEqual([0,3]); + expect(indexOfAll([1, 2, 3, 1, 2, 3], 1)).toEqual([0, 3]); }); test('Returns all indices of val in an array', () => { expect(indexOfAll([1, 2, 3], 4)).toEqual([]); diff --git a/test/initialize2DArray/initialize2DArray.test.js b/test/initialize2DArray/initialize2DArray.test.js index c0e33de36..885900afe 100644 --- a/test/initialize2DArray/initialize2DArray.test.js +++ b/test/initialize2DArray/initialize2DArray.test.js @@ -5,5 +5,5 @@ test('initialize2DArray is a Function', () => { expect(initialize2DArray).toBeInstanceOf(Function); }); test('Initializes a 2D array of given width and height and value', () => { - expect(initialize2DArray(2, 2, 0)).toEqual([[0,0], [0,0]]); + expect(initialize2DArray(2, 2, 0)).toEqual([[0, 0], [0, 0]]); }); diff --git a/test/intersectionWith/intersectionWith.test.js b/test/intersectionWith/intersectionWith.test.js index 7063575a7..b9a3b2008 100644 --- a/test/intersectionWith/intersectionWith.test.js +++ b/test/intersectionWith/intersectionWith.test.js @@ -5,5 +5,11 @@ test('intersectionWith is a Function', () => { expect(intersectionWith).toBeInstanceOf(Function); }); test('Returns a list of elements that exist in both arrays, using a provided comparator function', () => { - expect(intersectionWith([1, 1.2, 1.5, 3, 0], [1.9, 3, 0, 3.9], (a, b) => Math.round(a) === Math.round(b))).toEqual([1.5, 3, 0]); + expect( + intersectionWith( + [1, 1.2, 1.5, 3, 0], + [1.9, 3, 0, 3.9], + (a, b) => Math.round(a) === Math.round(b) + ) + ).toEqual([1.5, 3, 0]); }); diff --git a/test/invertKeyValues/invertKeyValues.test.js b/test/invertKeyValues/invertKeyValues.test.js index 00c6d5f85..3c431ee6a 100644 --- a/test/invertKeyValues/invertKeyValues.test.js +++ b/test/invertKeyValues/invertKeyValues.test.js @@ -4,9 +4,12 @@ const invertKeyValues = require('./invertKeyValues.js'); test('invertKeyValues is a Function', () => { expect(invertKeyValues).toBeInstanceOf(Function); }); -test('invertKeyValues({ a: 1, b: 2, c: 1 }) returns { 1: [ \'a\', \'c\' ], 2: [ \'b\' ] }', () => { - expect(invertKeyValues({ a: 1, b: 2, c: 1 })).toEqual({ 1: [ 'a', 'c' ], 2: [ 'b' ] }); +test("invertKeyValues({ a: 1, b: 2, c: 1 }) returns { 1: [ 'a', 'c' ], 2: [ 'b' ] }", () => { + expect(invertKeyValues({ a: 1, b: 2, c: 1 })).toEqual({ 1: ['a', 'c'], 2: ['b'] }); }); -test('invertKeyValues({ a: 1, b: 2, c: 1 }, value => \'group\' + value) returns { group1: [ \'a\', \'c\' ], group2: [ \'b\' ] }', () => { - expect(invertKeyValues({ a: 1, b: 2, c: 1 }, value => 'group' + value)).toEqual( { group1: [ 'a', 'c' ], group2: [ 'b' ] }); +test("invertKeyValues({ a: 1, b: 2, c: 1 }, value => 'group' + value) returns { group1: [ 'a', 'c' ], group2: [ 'b' ] }", () => { + expect(invertKeyValues({ a: 1, b: 2, c: 1 }, value => 'group' + value)).toEqual({ + group1: ['a', 'c'], + group2: ['b'] + }); }); diff --git a/test/isArray/isArray.js b/test/isArray/isArray.js index 87262d629..44cb6f381 100644 --- a/test/isArray/isArray.js +++ b/test/isArray/isArray.js @@ -1,2 +1,2 @@ const isArray = val => Array.isArray(val); - module.exports = isArray; +module.exports = isArray; diff --git a/test/isArrayBuffer/isArrayBuffer.js b/test/isArrayBuffer/isArrayBuffer.js index e68cb0141..bc888208e 100644 --- a/test/isArrayBuffer/isArrayBuffer.js +++ b/test/isArrayBuffer/isArrayBuffer.js @@ -1,2 +1,2 @@ const isArrayBuffer = val => val instanceof ArrayBuffer; - module.exports = isArrayBuffer; +module.exports = isArrayBuffer; diff --git a/test/isArrayLike/isArrayLike.test.js b/test/isArrayLike/isArrayLike.test.js index c2b83ecf9..b1ffb49d1 100644 --- a/test/isArrayLike/isArrayLike.test.js +++ b/test/isArrayLike/isArrayLike.test.js @@ -8,7 +8,7 @@ test('Returns true for a string', () => { expect(isArrayLike('abc')).toBeTruthy(); }); test('Returns true for an array', () => { - expect(isArrayLike([1,2,3])).toBeTruthy(); + expect(isArrayLike([1, 2, 3])).toBeTruthy(); }); test('Returns false for null', () => { expect(isArrayLike(null)).toBeFalsy(); diff --git a/test/isDivisible/isDivisible.test.js b/test/isDivisible/isDivisible.test.js index 3f71c4f03..e6a41305a 100644 --- a/test/isDivisible/isDivisible.test.js +++ b/test/isDivisible/isDivisible.test.js @@ -7,4 +7,3 @@ test('isDivisible is a Function', () => { test('The number 6 is divisible by 3', () => { expect(isDivisible(6, 3)).toBeTruthy(); }); - diff --git a/test/isFunction/isFunction.test.js b/test/isFunction/isFunction.test.js index 2d6d8db81..da7c3325a 100644 --- a/test/isFunction/isFunction.test.js +++ b/test/isFunction/isFunction.test.js @@ -10,4 +10,3 @@ test('passed value is a function', () => { test('passed value is not a function', () => { expect(isFunction('x')).toBeFalsy(); }); - diff --git a/test/isMap/isMap.js b/test/isMap/isMap.js index 1de74fe8d..8dc9687b4 100644 --- a/test/isMap/isMap.js +++ b/test/isMap/isMap.js @@ -1,2 +1,2 @@ const isMap = val => val instanceof Map; - module.exports = isMap; +module.exports = isMap; diff --git a/test/isObject/isObject.test.js b/test/isObject/isObject.test.js index 134cc9693..e7f570feb 100644 --- a/test/isObject/isObject.test.js +++ b/test/isObject/isObject.test.js @@ -16,4 +16,3 @@ test('isObject({ a:1 }) is a object', () => { test('isObject(true) is not a object', () => { expect(isObject(true)).toBeFalsy(); }); - diff --git a/test/isPrimitive/isPrimitive.test.js b/test/isPrimitive/isPrimitive.test.js index ac7e593e9..2d5179475 100644 --- a/test/isPrimitive/isPrimitive.test.js +++ b/test/isPrimitive/isPrimitive.test.js @@ -19,7 +19,7 @@ test('isPrimitive(true) is primitive', () => { test('isPrimitive(50) is primitive', () => { expect(isPrimitive(50)).toBeTruthy(); }); -test('isPrimitive(\'Hello\') is primitive', () => { +test("isPrimitive('Hello') is primitive", () => { expect(isPrimitive('Hello')).toBeTruthy(); }); test('isPrimitive(false) is primitive', () => { @@ -38,5 +38,5 @@ let start = new Date().getTime(); isPrimitive({ a: 123 }); let end = new Date().getTime(); test('isPrimitive({ a: 123 }) takes less than 2s to run', () => { - expect((end - start) < 2000).toBeTruthy(); + expect(end - start < 2000).toBeTruthy(); }); diff --git a/test/isPromiseLike/isPromiseLike.test.js b/test/isPromiseLike/isPromiseLike.test.js index 10877b4ec..7c3a17c28 100644 --- a/test/isPromiseLike/isPromiseLike.test.js +++ b/test/isPromiseLike/isPromiseLike.test.js @@ -5,11 +5,13 @@ test('isPromiseLike is a Function', () => { expect(isPromiseLike).toBeInstanceOf(Function); }); test('Returns true for a promise-like object', () => { - expect(isPromiseLike({ - then: function() { - return ''; - } - })).toBeTruthy(); + expect( + isPromiseLike({ + then: function() { + return ''; + } + }) + ).toBeTruthy(); }); test('Returns false for an empty object', () => { expect(isPromiseLike({})).toBeFalsy(); diff --git a/test/isRegExp/isRegExp.js b/test/isRegExp/isRegExp.js index 37bf3097c..bae7a3135 100644 --- a/test/isRegExp/isRegExp.js +++ b/test/isRegExp/isRegExp.js @@ -1,2 +1,2 @@ const isRegExp = val => val instanceof RegExp; - module.exports = isRegExp; +module.exports = isRegExp; diff --git a/test/isSet/isSet.js b/test/isSet/isSet.js index 7fa962361..d2a3b00cb 100644 --- a/test/isSet/isSet.js +++ b/test/isSet/isSet.js @@ -1,2 +1,2 @@ const isSet = val => val instanceof Set; - module.exports = isSet; +module.exports = isSet; diff --git a/test/isSimilar/isSimilar.js b/test/isSimilar/isSimilar.js index b8f7f2f69..7b0c9e77c 100644 --- a/test/isSimilar/isSimilar.js +++ b/test/isSimilar/isSimilar.js @@ -1,5 +1,11 @@ const isSimilar = (pattern, str) => - [...str].reduce( - (matchIndex, char) => char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase() ? matchIndex + 1 : matchIndex, 0 - ) === pattern.length ? true : false; + [...str].reduce( + (matchIndex, char) => + char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase() + ? matchIndex + 1 + : matchIndex, + 0 + ) === pattern.length + ? true + : false; module.exports = isSimilar; diff --git a/test/isTravisCI/isTravisCI.test.js b/test/isTravisCI/isTravisCI.test.js index 3417f7776..024b6869f 100644 --- a/test/isTravisCI/isTravisCI.test.js +++ b/test/isTravisCI/isTravisCI.test.js @@ -4,11 +4,11 @@ const isTravisCI = require('./isTravisCI.js'); test('isTravisCI is a Function', () => { expect(isTravisCI).toBeInstanceOf(Function); }); -if(isTravisCI()) +if (isTravisCI()) test('Running on Travis, correctly evaluates', () => { expect(isTravisCI()).toBeTruthy(); }); else test('Not running on Travis, correctly evaluates', () => { expect(isTravisCI()).toBeFalsy(); - }); + }); diff --git a/test/isTypedArray/isTypedArray.js b/test/isTypedArray/isTypedArray.js index 221deb7da..45e44809c 100644 --- a/test/isTypedArray/isTypedArray.js +++ b/test/isTypedArray/isTypedArray.js @@ -1,2 +1,2 @@ const isTypedArray = val => val instanceof TypedArray; - module.exports = isTypedArray; +module.exports = isTypedArray; diff --git a/test/isUpperCase/isUpperCase.test.js b/test/isUpperCase/isUpperCase.test.js index d094ca53e..0c2aeffa0 100644 --- a/test/isUpperCase/isUpperCase.test.js +++ b/test/isUpperCase/isUpperCase.test.js @@ -7,9 +7,9 @@ test('isUpperCase is a Function', () => { test('ABC is all upper case', () => { expect(isUpperCase('ABC')).toBeTruthy(); }); - test('abc is not all upper case', () => { +test('abc is not all upper case', () => { expect(isUpperCase('abc')).toBeFalsy(); }); - test('A3@$ is all uppercase', () => { +test('A3@$ is all uppercase', () => { expect(isUpperCase('A3@$')).toBeTruthy(); }); diff --git a/test/isWeakMap/isWeakMap.js b/test/isWeakMap/isWeakMap.js index ce857ea77..b53b69f5a 100644 --- a/test/isWeakMap/isWeakMap.js +++ b/test/isWeakMap/isWeakMap.js @@ -1,2 +1,2 @@ const isWeakMap = val => val instanceof WeakMap; - module.exports = isWeakMap; +module.exports = isWeakMap; diff --git a/test/isWeakSet/isWeakSet.js b/test/isWeakSet/isWeakSet.js index bea588905..c3b55777b 100644 --- a/test/isWeakSet/isWeakSet.js +++ b/test/isWeakSet/isWeakSet.js @@ -1,2 +1,2 @@ const isWeakSet = val => val instanceof WeakSet; - module.exports = isWeakSet; +module.exports = isWeakSet; diff --git a/test/join/join.test.js b/test/join/join.test.js index d9bf08285..cb5209563 100644 --- a/test/join/join.test.js +++ b/test/join/join.test.js @@ -12,4 +12,4 @@ test('Joins all elements of an array into a string and returns this string', () }); test('Joins all elements of an array into a string and returns this string', () => { expect(join(['pen', 'pineapple', 'apple', 'pen'])).toEqual('pen,pineapple,apple,pen'); -}); +}); diff --git a/test/last/last.test.js b/test/last/last.test.js index 48f7b4179..e86f71ecd 100644 --- a/test/last/last.test.js +++ b/test/last/last.test.js @@ -5,29 +5,35 @@ test('last is a Function', () => { expect(last).toBeInstanceOf(Function); }); test('last({ a: 1234}) returns undefined', () => { - expect(last({ a: 1234}) === undefined).toBeTruthy(); + expect(last({ a: 1234 }) === undefined).toBeTruthy(); }); test('last([1, 2, 3]) returns 3', () => { expect(last([1, 2, 3])).toBe(3); }); test('last({ 0: false}) returns undefined', () => { - expect(last({ 0: false})).toBe(undefined); + expect(last({ 0: false })).toBe(undefined); }); test('last(String) returns g', () => { expect(last('String')).toBe('g'); }); test('last(null) throws an Error', () => { - expect(() => { last(null); }).toThrow(); + expect(() => { + last(null); + }).toThrow(); }); test('last(undefined) throws an Error', () => { - expect(() => { last(undefined); }).toThrow(); + expect(() => { + last(undefined); + }).toThrow(); }); test('last() throws an Error', () => { - expect(() => { last(); }).toThrow(); + expect(() => { + last(); + }).toThrow(); }); let start = new Date().getTime(); last([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]); let end = new Date().getTime(); test('last([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run', () => { - expect((end - start) < 2000).toBeTruthy(); + expect(end - start < 2000).toBeTruthy(); }); diff --git a/test/levenshteinDistance/levenshteinDistance.js b/test/levenshteinDistance/levenshteinDistance.js index 9afe5fbc0..d9a76b41d 100644 --- a/test/levenshteinDistance/levenshteinDistance.js +++ b/test/levenshteinDistance/levenshteinDistance.js @@ -1,18 +1,25 @@ const levenshteinDistance = (string1, string2) => { - if(string1.length === 0) return string2.length; - if(string2.length === 0) return string1.length; - let matrix = Array(string2.length + 1).fill(0).map((x,i) => [i]); - matrix[0] = Array(string1.length + 1).fill(0).map((x,i) => i); - for(let i = 1; i <= string2.length; i++) { - for(let j = 1; j<=string1.length; j++) { - if(string2[i-1] === string1[j-1]) { - matrix[i][j] = matrix[i-1][j-1]; - } - else{ - matrix[i][j] = Math.min(matrix[i-1][j-1]+1, matrix[i][j-1]+1, matrix[i-1][j]+1); - } - } + if (string1.length === 0) return string2.length; + if (string2.length === 0) return string1.length; + let matrix = Array(string2.length + 1) + .fill(0) + .map((x, i) => [i]); + matrix[0] = Array(string1.length + 1) + .fill(0) + .map((x, i) => i); + for (let i = 1; i <= string2.length; i++) { + for (let j = 1; j <= string1.length; j++) { + if (string2[i - 1] === string1[j - 1]) { + matrix[i][j] = matrix[i - 1][j - 1]; + } else { + matrix[i][j] = Math.min( + matrix[i - 1][j - 1] + 1, + matrix[i][j - 1] + 1, + matrix[i - 1][j] + 1 + ); + } } - return matrix[string2.length][string1.length]; + } + return matrix[string2.length][string1.length]; }; module.exports = levenshteinDistance; diff --git a/test/lowercaseKeys/lowercaseKeys.test.js b/test/lowercaseKeys/lowercaseKeys.test.js index 37868e338..8fee98446 100644 --- a/test/lowercaseKeys/lowercaseKeys.test.js +++ b/test/lowercaseKeys/lowercaseKeys.test.js @@ -7,7 +7,7 @@ test('lowercaseKeys is a Function', () => { const myObj = { Name: 'Adam', sUrnAME: 'Smith' }; const myObjLower = lowercaseKeys(myObj); test('Lowercases object keys', () => { - expect(myObjLower).toEqual( {name: 'Adam', surname: 'Smith'}); + expect(myObjLower).toEqual({ name: 'Adam', surname: 'Smith' }); }); test('Does not mutate original object', () => { expect(myObj).toEqual({ Name: 'Adam', sUrnAME: 'Smith' }); diff --git a/test/matches/matches.test.js b/test/matches/matches.test.js index 221c9d950..58f07dd9c 100644 --- a/test/matches/matches.test.js +++ b/test/matches/matches.test.js @@ -5,8 +5,12 @@ test('matches is a Function', () => { expect(matches).toBeInstanceOf(Function); }); test('Matches returns true for two similar objects', () => { - expect(matches({ age: 25, hair: 'long', beard: true }, { hair: 'long', beard: true })).toBeTruthy(); + expect( + matches({ age: 25, hair: 'long', beard: true }, { hair: 'long', beard: true }) + ).toBeTruthy(); }); test('Matches returns false for two non-similar objects', () => { - expect(matches({ hair: 'long', beard: true }, { age: 25, hair: 'long', beard: true })).toBeFalsy(); + expect( + matches({ hair: 'long', beard: true }, { age: 25, hair: 'long', beard: true }) + ).toBeFalsy(); }); diff --git a/test/matchesWith/matchesWith.test.js b/test/matchesWith/matchesWith.test.js index 5de34f836..5627ae2af 100644 --- a/test/matchesWith/matchesWith.test.js +++ b/test/matchesWith/matchesWith.test.js @@ -6,9 +6,11 @@ test('matchesWith is a Function', () => { }); const isGreeting = val => /^h(?:i|ello)$/.test(val); test('Returns true for two objects with similar values, based on the provided function', () => { - expect(matchesWith( - { greeting: 'hello' }, - { greeting: 'hi' }, - (oV, sV) => isGreeting(oV) && isGreeting(sV) - )).toBeTruthy(); + expect( + matchesWith( + { greeting: 'hello' }, + { greeting: 'hi' }, + (oV, sV) => isGreeting(oV) && isGreeting(sV) + ) + ).toBeTruthy(); }); diff --git a/test/memoize/memoize.test.js b/test/memoize/memoize.test.js index ec8b0ca9e..b288861d3 100644 --- a/test/memoize/memoize.test.js +++ b/test/memoize/memoize.test.js @@ -13,5 +13,5 @@ test('Function works properly', () => { expect(square(3)).toBe(9); }); test('Cache stores values', () => { - expect(Array.from(square.cache)).toEqual([[2,4],[3,9]]); + expect(Array.from(square.cache)).toEqual([[2, 4], [3, 9]]); }); diff --git a/test/merge/merge.test.js b/test/merge/merge.test.js index e46ac3b4b..635966c14 100644 --- a/test/merge/merge.test.js +++ b/test/merge/merge.test.js @@ -14,5 +14,9 @@ const other = { c: 'foo' }; test('Merges two objects', () => { - expect(merge(object, other)).toEqual({ a: [ { x: 2 }, { y: 4 }, { z: 3 } ], b: [ 1, 2, 3 ], c: 'foo' }); + expect(merge(object, other)).toEqual({ + a: [{ x: 2 }, { y: 4 }, { z: 3 }], + b: [1, 2, 3], + c: 'foo' + }); }); diff --git a/test/minN/minN.test.js b/test/minN/minN.test.js index dd4269711..ac8fc29a9 100644 --- a/test/minN/minN.test.js +++ b/test/minN/minN.test.js @@ -8,5 +8,5 @@ test('Returns the n minimum elements from the provided array', () => { expect(minN([1, 2, 3])).toEqual([1]); }); test('Returns the n minimum elements from the provided array', () => { - expect(minN([1, 2, 3], 2), ).toEqual([1, 2]); + expect(minN([1, 2, 3], 2)).toEqual([1, 2]); }); diff --git a/test/none/none.test.js b/test/none/none.test.js index f46e207b0..fcc6c904c 100644 --- a/test/none/none.test.js +++ b/test/none/none.test.js @@ -5,14 +5,14 @@ test('none is a Function', () => { expect(none).toBeInstanceOf(Function); }); test('Returns true for arrays with no truthy values', () => { - expect(none([0,undefined,NaN,null,''])).toBeTruthy(); + expect(none([0, undefined, NaN, null, ''])).toBeTruthy(); }); test('Returns false for arrays with at least one truthy value', () => { - expect(none([0,1])).toBeFalsy(); + expect(none([0, 1])).toBeFalsy(); }); test('Returns true with a predicate function', () => { - expect(none([4,1,0,3], x => x < 0)).toBeTruthy(); + expect(none([4, 1, 0, 3], x => x < 0)).toBeTruthy(); }); test('Returns false with predicate function', () => { - expect(none([0,1,2], x => x === 1)).toBeFalsy(); + expect(none([0, 1, 2], x => x === 1)).toBeFalsy(); }); diff --git a/test/nthArg/nthArg.test.js b/test/nthArg/nthArg.test.js index 621f91dac..b5689e24a 100644 --- a/test/nthArg/nthArg.test.js +++ b/test/nthArg/nthArg.test.js @@ -15,4 +15,3 @@ const last = nthArg(-1); test('Works for negative values', () => { expect(last(1, 2, 3, 4, 5)).toBe(5); }); - diff --git a/test/objectFromPairs/objectFromPairs.test.js b/test/objectFromPairs/objectFromPairs.test.js index d1d4db8f8..fcb9e8c6a 100644 --- a/test/objectFromPairs/objectFromPairs.test.js +++ b/test/objectFromPairs/objectFromPairs.test.js @@ -4,6 +4,6 @@ const objectFromPairs = require('./objectFromPairs.js'); test('objectFromPairs is a Function', () => { expect(objectFromPairs).toBeInstanceOf(Function); }); - test('Creates an object from the given key-value pairs.', () => { - expect(objectFromPairs([['a', 1], ['b', 2]])).toEqual({a: 1, b: 2}); +test('Creates an object from the given key-value pairs.', () => { + expect(objectFromPairs([['a', 1], ['b', 2]])).toEqual({ a: 1, b: 2 }); }); diff --git a/test/objectToPairs/objectToPairs.test.js b/test/objectToPairs/objectToPairs.test.js index 5db49742a..da2dd0c5f 100644 --- a/test/objectToPairs/objectToPairs.test.js +++ b/test/objectToPairs/objectToPairs.test.js @@ -5,5 +5,5 @@ test('objectToPairs is a Function', () => { expect(objectToPairs).toBeInstanceOf(Function); }); test('Creates an array of key-value pair arrays from an object.', () => { - expect(objectToPairs({ a: 1, b: 2 })).toEqual([['a',1],['b', 2]]); + expect(objectToPairs({ a: 1, b: 2 })).toEqual([['a', 1], ['b', 2]]); }); diff --git a/test/omit/omit.test.js b/test/omit/omit.test.js index 50339eef4..05200cff3 100644 --- a/test/omit/omit.test.js +++ b/test/omit/omit.test.js @@ -5,5 +5,5 @@ test('omit is a Function', () => { expect(omit).toBeInstanceOf(Function); }); test('Omits the key-value pairs corresponding to the given keys from an object', () => { - expect(omit({ a: 1, b: '2', c: 3 }, ['b'])).toEqual({ 'a': 1, 'c': 3 }); + expect(omit({ a: 1, b: '2', c: 3 }, ['b'])).toEqual({ a: 1, c: 3 }); }); diff --git a/test/omitBy/omitBy.test.js b/test/omitBy/omitBy.test.js index b380731b6..3d433f904 100644 --- a/test/omitBy/omitBy.test.js +++ b/test/omitBy/omitBy.test.js @@ -5,5 +5,5 @@ test('omitBy is a Function', () => { expect(omitBy).toBeInstanceOf(Function); }); test('Creates an object composed of the properties the given function returns falsey for', () => { - expect(omitBy({ a: 1, b: '2', c: 3 }, x => typeof x === 'number')).toEqual( { b: '2' }); + expect(omitBy({ a: 1, b: '2', c: 3 }, x => typeof x === 'number')).toEqual({ b: '2' }); }); diff --git a/test/orderBy/orderBy.test.js b/test/orderBy/orderBy.test.js index 48d838468..119950376 100644 --- a/test/orderBy/orderBy.test.js +++ b/test/orderBy/orderBy.test.js @@ -6,8 +6,16 @@ test('orderBy is a Function', () => { }); const users = [{ name: 'fred', age: 48 }, { name: 'barney', age: 36 }, { name: 'fred', age: 40 }]; test('Returns a sorted array of objects ordered by properties and orders.', () => { - expect(orderBy(users, ['name', 'age'], ['asc', 'desc'])).toEqual([{name: 'barney', age: 36}, {name: 'fred', age: 48}, {name: 'fred', age: 40}]); + expect(orderBy(users, ['name', 'age'], ['asc', 'desc'])).toEqual([ + { name: 'barney', age: 36 }, + { name: 'fred', age: 48 }, + { name: 'fred', age: 40 } + ]); }); test('Returns a sorted array of objects ordered by properties and orders.', () => { - expect(orderBy(users, ['name', 'age'])).toEqual( [{name: 'barney', age: 36}, {name: 'fred', age: 40}, {name: 'fred', age: 48}]); + expect(orderBy(users, ['name', 'age'])).toEqual([ + { name: 'barney', age: 36 }, + { name: 'fred', age: 40 }, + { name: 'fred', age: 48 } + ]); }); diff --git a/test/over/over.test.js b/test/over/over.test.js index 1ca8f5885..f4b7dd578 100644 --- a/test/over/over.test.js +++ b/test/over/over.test.js @@ -6,5 +6,5 @@ test('over is a Function', () => { }); const minMax = over(Math.min, Math.max); test('Applies given functions over multiple arguments', () => { - expect(minMax(1, 2, 3, 4, 5)).toEqual([1,5]); + expect(minMax(1, 2, 3, 4, 5)).toEqual([1, 5]); }); diff --git a/test/pad/pad.test.js b/test/pad/pad.test.js index a90623980..d01e4a983 100644 --- a/test/pad/pad.test.js +++ b/test/pad/pad.test.js @@ -5,14 +5,14 @@ test('pad is a Function', () => { expect(pad).toBeInstanceOf(Function); }); test('cat is padded on both sides', () => { - expect(pad('cat',8)).toBe(' cat '); + expect(pad('cat', 8)).toBe(' cat '); }); - test('length of string is 8', () => { - expect(pad('cat',8).length).toBe(8); +test('length of string is 8', () => { + expect(pad('cat', 8).length).toBe(8); }); - test('pads 42 with "0"', () => { +test('pads 42 with "0"', () => { expect(pad(String(42), 6, '0')).toBe('004200'); }); - test('does not truncates if string exceeds length', () => { +test('does not truncates if string exceeds length', () => { expect(pad('foobar', 3)).toBe('foobar'); }); diff --git a/test/partition/partition.test.js b/test/partition/partition.test.js index 4cb266592..d86d95124 100644 --- a/test/partition/partition.test.js +++ b/test/partition/partition.test.js @@ -5,6 +5,9 @@ test('partition is a Function', () => { expect(partition).toBeInstanceOf(Function); }); const users = [{ user: 'barney', age: 36, active: false }, { user: 'fred', age: 40, active: true }]; -test('Groups the elements into two arrays, depending on the provided function\'s truthiness for each element.', () => { - expect(partition(users, o => o.active)).toEqual([[{ 'user': 'fred', 'age': 40, 'active': true }],[{ 'user': 'barney', 'age': 36, 'active': false }]]); +test("Groups the elements into two arrays, depending on the provided function's truthiness for each element.", () => { + expect(partition(users, o => o.active)).toEqual([ + [{ user: 'fred', age: 40, active: true }], + [{ user: 'barney', age: 36, active: false }] + ]); }); diff --git a/test/permutations/permutations.test.js b/test/permutations/permutations.test.js index 3dee8589c..d7c085a7f 100644 --- a/test/permutations/permutations.test.js +++ b/test/permutations/permutations.test.js @@ -5,5 +5,12 @@ test('permutations is a Function', () => { expect(permutations).toBeInstanceOf(Function); }); test('Generates all permutations of an array', () => { - expect(permutations([1, 33, 5])).toEqual([ [ 1, 33, 5 ], [ 1, 5, 33 ], [ 33, 1, 5 ], [ 33, 5, 1 ], [ 5, 1, 33 ], [ 5, 33, 1 ] ]); + expect(permutations([1, 33, 5])).toEqual([ + [1, 33, 5], + [1, 5, 33], + [33, 1, 5], + [33, 5, 1], + [5, 1, 33], + [5, 33, 1] + ]); }); diff --git a/test/pick/pick.test.js b/test/pick/pick.test.js index 95281c19a..08cac4fe2 100644 --- a/test/pick/pick.test.js +++ b/test/pick/pick.test.js @@ -5,5 +5,5 @@ test('pick is a Function', () => { expect(pick).toBeInstanceOf(Function); }); test('Picks the key-value pairs corresponding to the given keys from an object.', () => { - expect(pick({ a: 1, b: '2', c: 3 }, ['a', 'c'])).toEqual({ 'a': 1, 'c': 3 }); + expect(pick({ a: 1, b: '2', c: 3 }, ['a', 'c'])).toEqual({ a: 1, c: 3 }); }); diff --git a/test/pickBy/pickBy.test.js b/test/pickBy/pickBy.test.js index 1d302187c..d0d679682 100644 --- a/test/pickBy/pickBy.test.js +++ b/test/pickBy/pickBy.test.js @@ -5,5 +5,5 @@ test('pickBy is a Function', () => { expect(pickBy).toBeInstanceOf(Function); }); test('Creates an object composed of the properties the given function returns truthy for.', () => { - expect(pickBy({ a: 1, b: '2', c: 3 }, x => typeof x === 'number')).toEqual({ 'a': 1, 'c': 3 }); + expect(pickBy({ a: 1, b: '2', c: 3 }, x => typeof x === 'number')).toEqual({ a: 1, c: 3 }); }); diff --git a/test/pipeAsyncFunctions/pipeAsyncFunctions.test.js b/test/pipeAsyncFunctions/pipeAsyncFunctions.test.js index 2ca7213c8..a53006bf4 100644 --- a/test/pipeAsyncFunctions/pipeAsyncFunctions.test.js +++ b/test/pipeAsyncFunctions/pipeAsyncFunctions.test.js @@ -5,11 +5,12 @@ test('pipeAsyncFunctions is a Function', () => { expect(pipeAsyncFunctions).toBeInstanceOf(Function); }); test('pipeAsyncFunctions result should be 15', () => { - expect(pipeAsyncFunctions( - (x) => x + 1, - (x) => new Promise((resolve) => setTimeout(() => resolve(x + 2), 0)), - (x) => x + 3, - async(x) => await x + 4, - ) - (5)).resolves.toBe(15); + expect( + pipeAsyncFunctions( + x => x + 1, + x => new Promise(resolve => setTimeout(() => resolve(x + 2), 0)), + x => x + 3, + async x => (await x) + 4 + )(5) + ).resolves.toBe(15); }); diff --git a/test/prefix/prefix.test.js b/test/prefix/prefix.test.js index 4f6e86f19..b2c491ad4 100644 --- a/test/prefix/prefix.test.js +++ b/test/prefix/prefix.test.js @@ -3,4 +3,4 @@ const prefix = require('./prefix.js'); test('prefix is a Function', () => { expect(prefix).toBeInstanceOf(Function); -}); +}); diff --git a/test/pull/pull.test.js b/test/pull/pull.test.js index 3afff9097..5a3ba43d1 100644 --- a/test/pull/pull.test.js +++ b/test/pull/pull.test.js @@ -7,5 +7,5 @@ test('pull is a Function', () => { let myArray = ['a', 'b', 'c', 'a', 'b', 'c']; pull(myArray, 'a', 'c'); test('Pulls the specified values', () => { - expect(myArray).toEqual(['b','b']); + expect(myArray).toEqual(['b', 'b']); }); diff --git a/test/pullAtIndex/pullAtIndex.test.js b/test/pullAtIndex/pullAtIndex.test.js index 4ebe0b1a5..380dee163 100644 --- a/test/pullAtIndex/pullAtIndex.test.js +++ b/test/pullAtIndex/pullAtIndex.test.js @@ -7,8 +7,8 @@ test('pullAtIndex is a Function', () => { let myArray = ['a', 'b', 'c', 'd']; let pulled = pullAtIndex(myArray, [1, 3]); test('Pulls the given values', () => { - expect(myArray).toEqual([ 'a', 'c' ]); + expect(myArray).toEqual(['a', 'c']); }); - test('Pulls the given values', () => { - expect(pulled).toEqual([ 'b', 'd' ]); +test('Pulls the given values', () => { + expect(pulled).toEqual(['b', 'd']); }); diff --git a/test/pullAtValue/pullAtValue.test.js b/test/pullAtValue/pullAtValue.test.js index 778f215bc..261704da7 100644 --- a/test/pullAtValue/pullAtValue.test.js +++ b/test/pullAtValue/pullAtValue.test.js @@ -7,8 +7,8 @@ test('pullAtValue is a Function', () => { let myArray = ['a', 'b', 'c', 'd']; let pulled = pullAtValue(myArray, ['b', 'd']); test('Pulls the specified values', () => { - expect(myArray).toEqual([ 'a', 'c' ]); + expect(myArray).toEqual(['a', 'c']); }); - test('Pulls the specified values', () => { - expect(pulled).toEqual([ 'b', 'd' ]); +test('Pulls the specified values', () => { + expect(pulled).toEqual(['b', 'd']); }); diff --git a/test/quickSort/quickSort.test.js b/test/quickSort/quickSort.test.js index b15e58969..780f81c93 100644 --- a/test/quickSort/quickSort.test.js +++ b/test/quickSort/quickSort.test.js @@ -11,23 +11,33 @@ test('quickSort([-1, 0, -2]) returns [-2, -1, 0]', () => { expect(quickSort([-1, 0, -2])).toEqual([-2, -1, 0]); }); test('quickSort() throws an error', () => { - expect(() => { quickSort(); }).toThrow(); + expect(() => { + quickSort(); + }).toThrow(); }); test('quickSort(123) throws an error', () => { - expect(() => { quickSort(123); }).toThrow(); + expect(() => { + quickSort(123); + }).toThrow(); }); test('quickSort({ 234: string}) throws an error', () => { - expect(() => { quickSort({ 234: string}); }).toThrow(); + expect(() => { + quickSort({ 234: string }); + }).toThrow(); }); test('quickSort(null) throws an error', () => { - expect(() => { quickSort(null); }).toThrow(); + expect(() => { + quickSort(null); + }).toThrow(); }); test('quickSort(undefined) throws an error', () => { - expect(() => { quickSort(undefined); }).toThrow(); + expect(() => { + quickSort(undefined); + }).toThrow(); }); let start = new Date().getTime(); quickSort([11, 1, 324, 23232, -1, 53, 2, 524, 32, 13, 156, 133, 62, 12, 4]); let end = new Date().getTime(); test('quickSort([11, 1, 324, 23232, -1, 53, 2, 524, 32, 13, 156, 133, 62, 12, 4]) takes less than 2s to run', () => { - expect((end - start) < 2000).toBeTruthy(); + expect(end - start < 2000).toBeTruthy(); }); diff --git a/test/randomHexColorCode/randomHexColorCode.test.js b/test/randomHexColorCode/randomHexColorCode.test.js index bc38748a7..353cd2c4c 100644 --- a/test/randomHexColorCode/randomHexColorCode.test.js +++ b/test/randomHexColorCode/randomHexColorCode.test.js @@ -11,5 +11,9 @@ test('The color code starts with "#"', () => { expect(randomHexColorCode().startsWith('#')).toBeTruthy(); }); test('The color code contains only valid hex-digits', () => { - expect(randomHexColorCode().slice(1).match(/[^0123456789abcdef]/i) === null).toBeTruthy(); + expect( + randomHexColorCode() + .slice(1) + .match(/[^0123456789abcdef]/i) === null + ).toBeTruthy(); }); diff --git a/test/randomIntArrayInRange/randomIntArrayInRange.test.js b/test/randomIntArrayInRange/randomIntArrayInRange.test.js index 9a2c1acb3..f0e9e4913 100644 --- a/test/randomIntArrayInRange/randomIntArrayInRange.test.js +++ b/test/randomIntArrayInRange/randomIntArrayInRange.test.js @@ -6,13 +6,13 @@ test('randomIntArrayInRange is a Function', () => { }); const lowerLimit = Math.floor(Math.random() * 20); const upperLimit = Math.floor(lowerLimit + Math.random() * 10); -const arr = randomIntArrayInRange(lowerLimit,upperLimit, 10); +const arr = randomIntArrayInRange(lowerLimit, upperLimit, 10); test('The returned array contains only integers', () => { expect(arr.every(x => typeof x === 'number')).toBeTruthy(); }); test('The returned array has the proper length', () => { expect(arr.length).toBe(10); }); -test('The returned array\'s values lie between provided lowerLimit and upperLimit (both inclusive).', () => { - expect(arr.every(x => (x >= lowerLimit) && (x <= upperLimit))).toBeTruthy(); +test("The returned array's values lie between provided lowerLimit and upperLimit (both inclusive).", () => { + expect(arr.every(x => x >= lowerLimit && x <= upperLimit)).toBeTruthy(); }); diff --git a/test/randomIntegerInRange/randomIntegerInRange.test.js b/test/randomIntegerInRange/randomIntegerInRange.test.js index ff19ca7f9..1e7179441 100644 --- a/test/randomIntegerInRange/randomIntegerInRange.test.js +++ b/test/randomIntegerInRange/randomIntegerInRange.test.js @@ -7,9 +7,9 @@ test('randomIntegerInRange is a Function', () => { const lowerLimit = Math.floor(Math.random() * 20); const upperLimit = Math.floor(lowerLimit + Math.random() * 10); test('The returned value is an integer', () => { - expect(Number.isInteger(randomIntegerInRange(lowerLimit,upperLimit))).toBeTruthy(); + expect(Number.isInteger(randomIntegerInRange(lowerLimit, upperLimit))).toBeTruthy(); }); -const numberForTest = randomIntegerInRange(lowerLimit,upperLimit); +const numberForTest = randomIntegerInRange(lowerLimit, upperLimit); test('The returned value lies between provided lowerLimit and upperLimit (both inclusive).', () => { - expect((numberForTest >= lowerLimit) && (numberForTest <= upperLimit)).toBeTruthy(); + expect(numberForTest >= lowerLimit && numberForTest <= upperLimit).toBeTruthy(); }); diff --git a/test/randomNumberInRange/randomNumberInRange.test.js b/test/randomNumberInRange/randomNumberInRange.test.js index b688cf3fe..f3eb1ddd8 100644 --- a/test/randomNumberInRange/randomNumberInRange.test.js +++ b/test/randomNumberInRange/randomNumberInRange.test.js @@ -7,9 +7,9 @@ test('randomNumberInRange is a Function', () => { const lowerLimit = Math.floor(Math.random() * 20); const upperLimit = Math.floor(lowerLimit + Math.random() * 10); test('The returned value is a number', () => { - expect(typeof randomNumberInRange(lowerLimit,upperLimit) === 'number').toBeTruthy(); + expect(typeof randomNumberInRange(lowerLimit, upperLimit) === 'number').toBeTruthy(); }); -const numberForTest = randomNumberInRange(lowerLimit,upperLimit); +const numberForTest = randomNumberInRange(lowerLimit, upperLimit); test('The returned value lies between provided lowerLimit and upperLimit (both inclusive).', () => { - expect((numberForTest >= lowerLimit) && (numberForTest <= upperLimit)).toBeTruthy(); + expect(numberForTest >= lowerLimit && numberForTest <= upperLimit).toBeTruthy(); }); diff --git a/test/reduceSuccessive/reduceSuccessive.test.js b/test/reduceSuccessive/reduceSuccessive.test.js index 5045bed01..333e613af 100644 --- a/test/reduceSuccessive/reduceSuccessive.test.js +++ b/test/reduceSuccessive/reduceSuccessive.test.js @@ -5,5 +5,13 @@ test('reduceSuccessive is a Function', () => { expect(reduceSuccessive).toBeInstanceOf(Function); }); test('Returns the array of successively reduced values', () => { - expect(reduceSuccessive([1, 2, 3, 4, 5, 6], (acc, val) => acc + val, 0)).toEqual([0, 1, 3, 6, 10, 15, 21]); + expect(reduceSuccessive([1, 2, 3, 4, 5, 6], (acc, val) => acc + val, 0)).toEqual([ + 0, + 1, + 3, + 6, + 10, + 15, + 21 + ]); }); diff --git a/test/reduceWhich/reduceWhich.test.js b/test/reduceWhich/reduceWhich.test.js index dc9625699..7789a74e9 100644 --- a/test/reduceWhich/reduceWhich.test.js +++ b/test/reduceWhich/reduceWhich.test.js @@ -11,8 +11,10 @@ test('Returns the maximum of an array', () => { expect(reduceWhich([1, 3, 2], (a, b) => b - a)).toBe(3); }); test('Returns the object with the minimum specified value in an array', () => { - expect(reduceWhich( - [{ name: 'Tom', age: 12 }, { name: 'Jack', age: 18 }, { name: 'Lucy', age: 9 }], - (a, b) => a.age - b.age -)).toEqual({name: "Lucy", age: 9}); + expect( + reduceWhich( + [{ name: 'Tom', age: 12 }, { name: 'Jack', age: 18 }, { name: 'Lucy', age: 9 }], + (a, b) => a.age - b.age + ) + ).toEqual({ name: 'Lucy', age: 9 }); }); diff --git a/test/reducedFilter/reducedFilter.test.js b/test/reducedFilter/reducedFilter.test.js index 4fb7a0b94..bd37980ee 100644 --- a/test/reducedFilter/reducedFilter.test.js +++ b/test/reducedFilter/reducedFilter.test.js @@ -5,17 +5,19 @@ test('reducedFilter is a Function', () => { expect(reducedFilter).toBeInstanceOf(Function); }); const data = [ -{ - id: 1, - name: 'john', - age: 24 -}, -{ - id: 2, - name: 'mike', - age: 50 -} + { + id: 1, + name: 'john', + age: 24 + }, + { + id: 2, + name: 'mike', + age: 50 + } ]; test('Filter an array of objects based on a condition while also filtering out unspecified keys.', () => { - expect(reducedFilter(data, ['id', 'name'], item => item.age > 24)).toEqual([{ id: 2, name: 'mike'}]); + expect(reducedFilter(data, ['id', 'name'], item => item.age > 24)).toEqual([ + { id: 2, name: 'mike' } + ]); }); diff --git a/test/reject/reject.test.js b/test/reject/reject.test.js index f14e41299..3dddd9fb2 100644 --- a/test/reject/reject.test.js +++ b/test/reject/reject.test.js @@ -4,17 +4,11 @@ const reject = require('./reject.js'); test('reject is a Function', () => { expect(reject).toBeInstanceOf(Function); }); -const noEvens = reject( - (x) => x % 2 === 0, - [1, 2, 3, 4, 5] -); +const noEvens = reject(x => x % 2 === 0, [1, 2, 3, 4, 5]); test('Works with numbers', () => { expect(noEvens).toEqual([1, 3, 5]); }); -const fourLettersOrLess = reject( - (word) => word.length > 4, - ['Apple', 'Pear', 'Kiwi', 'Banana'] -); +const fourLettersOrLess = reject(word => word.length > 4, ['Apple', 'Pear', 'Kiwi', 'Banana']); test('Works with strings', () => { expect(fourLettersOrLess).toEqual(['Pear', 'Kiwi']); }); diff --git a/test/removeVowels/removeVowels.js b/test/removeVowels/removeVowels.js index 1614fa7ce..31250b816 100644 --- a/test/removeVowels/removeVowels.js +++ b/test/removeVowels/removeVowels.js @@ -1,2 +1,2 @@ -const removeVowels = (str, repl = '') => str.replace(/[aeiou]/gi,repl); +const removeVowels = (str, repl = '') => str.replace(/[aeiou]/gi, repl); module.exports = removeVowels; diff --git a/test/removeVowels/removeVowels.test.js b/test/removeVowels/removeVowels.test.js index 437f32157..a9e2458f8 100644 --- a/test/removeVowels/removeVowels.test.js +++ b/test/removeVowels/removeVowels.test.js @@ -3,4 +3,4 @@ const removeVowels = require('./removeVowels.js'); test('removeVowels is a Function', () => { expect(removeVowels).toBeInstanceOf(Function); -}); +}); diff --git a/test/round/round.test.js b/test/round/round.test.js index c72bb69c9..b3a834bf6 100644 --- a/test/round/round.test.js +++ b/test/round/round.test.js @@ -19,21 +19,21 @@ test('round(1.005) returns 1', () => { test('round([1.005, 2]) returns NaN', () => { expect(isNaN(round([1.005, 2]))).toBeTruthy(); }); - test('round(string) returns NaN', () => { +test('round(string) returns NaN', () => { expect(isNaN(round('string'))).toBeTruthy(); }); - test('round() returns NaN', () => { +test('round() returns NaN', () => { expect(isNaN(round())).toBeTruthy(); }); - test('round(132, 413, 4134) returns NaN', () => { +test('round(132, 413, 4134) returns NaN', () => { expect(isNaN(round(132, 413, 4134))).toBeTruthy(); }); - test('round({a: 132}, 413) returns NaN', () => { - expect(isNaN(round({a: 132}, 413))).toBeTruthy(); +test('round({a: 132}, 413) returns NaN', () => { + expect(isNaN(round({ a: 132 }, 413))).toBeTruthy(); }); let start = new Date().getTime(); round(123.3423345345345345344, 11); let end = new Date().getTime(); test('round(123.3423345345345345344, 11) takes less than 2s to run', () => { - expect((end - start) < 2000).toBeTruthy(); + expect(end - start < 2000).toBeTruthy(); }); diff --git a/test/runPromisesInSeries/runPromisesInSeries.test.js b/test/runPromisesInSeries/runPromisesInSeries.test.js index 1fb99d262..489a95859 100644 --- a/test/runPromisesInSeries/runPromisesInSeries.test.js +++ b/test/runPromisesInSeries/runPromisesInSeries.test.js @@ -1,7 +1,6 @@ const expect = require('expect'); const runPromisesInSeries = require('./runPromisesInSeries.js'); - test('runPromisesInSeries is a Function', () => { expect(runPromisesInSeries).toBeInstanceOf(Function); }); diff --git a/test/sample/sample.test.js b/test/sample/sample.test.js index 199f8504b..e2549df61 100644 --- a/test/sample/sample.test.js +++ b/test/sample/sample.test.js @@ -4,7 +4,7 @@ const sample = require('./sample.js'); test('sample is a Function', () => { expect(sample).toBeInstanceOf(Function); }); -const arr = [3,7,9,11]; +const arr = [3, 7, 9, 11]; test('Returns a random element from the array', () => { expect(arr.includes(sample(arr))).toBeTruthy(); }); diff --git a/test/sampleSize/sampleSize.test.js b/test/sampleSize/sampleSize.test.js index 22d72d238..ef5b3ae96 100644 --- a/test/sampleSize/sampleSize.test.js +++ b/test/sampleSize/sampleSize.test.js @@ -4,7 +4,7 @@ const sampleSize = require('./sampleSize.js'); test('sampleSize is a Function', () => { expect(sampleSize).toBeInstanceOf(Function); }); -const arr = [3,7,9,11]; +const arr = [3, 7, 9, 11]; test('Returns a single element without n specified', () => { expect(sampleSize(arr).length).toBe(1); }); diff --git a/test/setStyle/setStyle.test.js b/test/setStyle/setStyle.test.js index 92be89a6e..2982ae7cd 100644 --- a/test/setStyle/setStyle.test.js +++ b/test/setStyle/setStyle.test.js @@ -3,4 +3,4 @@ const setStyle = require('./setStyle.js'); test('setStyle is a Function', () => { expect(setStyle).toBeInstanceOf(Function); -}); +}); diff --git a/test/shuffle/shuffle.test.js b/test/shuffle/shuffle.test.js index ae6630c2f..c71985f8e 100644 --- a/test/shuffle/shuffle.test.js +++ b/test/shuffle/shuffle.test.js @@ -4,7 +4,7 @@ const shuffle = require('./shuffle.js'); test('shuffle is a Function', () => { expect(shuffle).toBeInstanceOf(Function); }); -const arr = [1,2,3,4,5,6]; +const arr = [1, 2, 3, 4, 5, 6]; test('Shuffles the array', () => { expect(shuffle(arr)).not.toEqual(arr); }); diff --git a/test/splitLines/splitLines.test.js b/test/splitLines/splitLines.test.js index 18a591ba3..c35d956b9 100644 --- a/test/splitLines/splitLines.test.js +++ b/test/splitLines/splitLines.test.js @@ -5,5 +5,11 @@ 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')).toEqual(['This', 'is a', 'multiline', 'string.', '']); + expect(splitLines('This\nis a\nmultiline\nstring.\n')).toEqual([ + 'This', + 'is a', + 'multiline', + 'string.', + '' + ]); }); diff --git a/test/standardDeviation/standardDeviation.test.js b/test/standardDeviation/standardDeviation.test.js index 0bf680689..2836df632 100644 --- a/test/standardDeviation/standardDeviation.test.js +++ b/test/standardDeviation/standardDeviation.test.js @@ -5,8 +5,8 @@ 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])).toBeCloseTo(13.284434142114991,5); + 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)).toBeCloseTo(12.29899614287479,5); + 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 b97252f6d..80019e110 100644 --- a/test/stringPermutations/stringPermutations.test.js +++ b/test/stringPermutations/stringPermutations.test.js @@ -5,7 +5,7 @@ test('stringPermutations is a Function', () => { expect(stringPermutations).toBeInstanceOf(Function); }); test('Generates all stringPermutations of a string', () => { - expect(stringPermutations('abc')).toEqual(['abc','acb','bac','bca','cab','cba']); + expect(stringPermutations('abc')).toEqual(['abc', 'acb', 'bac', 'bca', 'cab', 'cba']); }); test('Works for single-letter strings', () => { expect(stringPermutations('a')).toEqual(['a']); diff --git a/test/stripHTMLTags/stripHTMLTags.test.js b/test/stripHTMLTags/stripHTMLTags.test.js index fe434e44f..1543517a2 100644 --- a/test/stripHTMLTags/stripHTMLTags.test.js +++ b/test/stripHTMLTags/stripHTMLTags.test.js @@ -5,5 +5,7 @@ test('stripHTMLTags is a Function', () => { expect(stripHTMLTags).toBeInstanceOf(Function); }); test('Removes HTML tags', () => { - expect(stripHTMLTags('

lorem ipsum


')).toBe('lorem ipsum'); + expect(stripHTMLTags('

lorem ipsum


')).toBe( + 'lorem ipsum' + ); }); diff --git a/test/symmetricDifferenceBy/symmetricDifferenceBy.test.js b/test/symmetricDifferenceBy/symmetricDifferenceBy.test.js index 320cd8905..526ed9f50 100644 --- a/test/symmetricDifferenceBy/symmetricDifferenceBy.test.js +++ b/test/symmetricDifferenceBy/symmetricDifferenceBy.test.js @@ -5,5 +5,5 @@ 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)).toEqual([ 1.2, 3.4 ]); + 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 ca4920797..44c7a4a3c 100644 --- a/test/symmetricDifferenceWith/symmetricDifferenceWith.test.js +++ b/test/symmetricDifferenceWith/symmetricDifferenceWith.test.js @@ -5,8 +5,11 @@ test('symmetricDifferenceWith is a Function', () => { expect(symmetricDifferenceWith).toBeInstanceOf(Function); }); 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))).toEqual([1, 1.2, 3.9]); + expect( + symmetricDifferenceWith( + [1, 1.2, 1.5, 3, 0], + [1.9, 3, 0, 3.9], + (a, b) => Math.round(a) === Math.round(b) + ) + ).toEqual([1, 1.2, 3.9]); }); diff --git a/test/toCamelCase/toCamelCase.test.js b/test/toCamelCase/toCamelCase.test.js index 1443c9c98..4681dbe9c 100644 --- a/test/toCamelCase/toCamelCase.test.js +++ b/test/toCamelCase/toCamelCase.test.js @@ -4,33 +4,45 @@ const toCamelCase = require('./toCamelCase.js'); test('toCamelCase is a Function', () => { expect(toCamelCase).toBeInstanceOf(Function); }); -test('toCamelCase(\'some_database_field_name\') returns 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', () => { +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' + ); }); test('toCamelCase() throws a error', () => { - expect(() => {toCamelCase(); }).toThrow(); + expect(() => { + toCamelCase(); + }).toThrow(); }); test('toCamelCase([]) throws a error', () => { - expect(() => {toCamelCase([]); }).toThrow(); + expect(() => { + toCamelCase([]); + }).toThrow(); }); test('toCamelCase({}) throws a error', () => { - expect(() => {toCamelCase({}); }).toThrow(); + expect(() => { + toCamelCase({}); + }).toThrow(); }); test('toCamelCase(123) throws a error', () => { - expect(() => {toCamelCase(123); }).toThrow(); + 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(); + expect(end - start < 2000).toBeTruthy(); }); diff --git a/test/toCurrency/toCurrency.test.js b/test/toCurrency/toCurrency.test.js index b8fdf0a22..9f0aa3fdb 100644 --- a/test/toCurrency/toCurrency.test.js +++ b/test/toCurrency/toCurrency.test.js @@ -11,5 +11,7 @@ test(' currency: US Dollar | currencyLangFormat: English (United States)', () => expect(toCurrency(123456.789, 'USD', 'en-us')).toEqual(expect.stringMatching(/\$\s*123,456.79/g)); }); test('currency: Japanese Yen | currencyLangFormat: Local', () => { - expect(toCurrency(322342436423.2435, 'JPY')).toEqual(expect.stringMatching(/J*P*¥\s*322,342,436,423/g)); + expect(toCurrency(322342436423.2435, 'JPY')).toEqual( + expect.stringMatching(/J*P*¥\s*322,342,436,423/g) + ); }); diff --git a/test/toDecimalMark/toDecimalMark.test.js b/test/toDecimalMark/toDecimalMark.test.js index 017f3723c..8b287fdbb 100644 --- a/test/toDecimalMark/toDecimalMark.test.js +++ b/test/toDecimalMark/toDecimalMark.test.js @@ -5,5 +5,5 @@ test('toDecimalMark is a Function', () => { expect(toDecimalMark).toBeInstanceOf(Function); }); test('convert a float-point arithmetic to the Decimal mark form', () => { - expect(toDecimalMark(12305030388.9087)).toBe("12,305,030,388.909"); + expect(toDecimalMark(12305030388.9087)).toBe('12,305,030,388.909'); }); diff --git a/test/toKebabCase/toKebabCase.test.js b/test/toKebabCase/toKebabCase.test.js index c3fcc36b4..38017653e 100644 --- a/test/toKebabCase/toKebabCase.test.js +++ b/test/toKebabCase/toKebabCase.test.js @@ -4,33 +4,45 @@ const toKebabCase = require('./toKebabCase.js'); test('toKebabCase is a Function', () => { expect(toKebabCase).toBeInstanceOf(Function); }); -test('toKebabCase(\'camelCase\') returns camel-case', () => { +test("toKebabCase('camelCase') returns camel-case", () => { expect(toKebabCase('camelCase')).toBe('camel-case'); }); -test('toKebabCase(\'some text\') returns 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', () => { - 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('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() returns undefined', () => { expect(toKebabCase()).toBe(undefined); }); test('toKebabCase([]) throws an erro', () => { - expect(() => { toKebabCase([]); }).toThrow(); + expect(() => { + toKebabCase([]); + }).toThrow(); }); test('toKebabCase({}) throws an erro', () => { - expect(() => { toKebabCase({}); }).toThrow(); + expect(() => { + toKebabCase({}); + }).toThrow(); }); test('toKebabCase(123) throws an erro', () => { - expect(() => { toKebabCase(123); }).toThrow(); + 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(); + expect(end - start < 2000).toBeTruthy(); }); diff --git a/test/toSafeInteger/toSafeInteger.test.js b/test/toSafeInteger/toSafeInteger.test.js index 29901a2b5..634d6484f 100644 --- a/test/toSafeInteger/toSafeInteger.test.js +++ b/test/toSafeInteger/toSafeInteger.test.js @@ -10,7 +10,7 @@ test('Number(toSafeInteger(3.2)) is a number', () => { test('Converts a value to a safe integer', () => { expect(toSafeInteger(3.2)).toBe(3); }); -test('toSafeInteger(\'4.2\') returns 4', () => { +test("toSafeInteger('4.2') returns 4", () => { expect(toSafeInteger('4.2')).toBe(4); }); test('toSafeInteger(4.6) returns 5', () => { @@ -22,7 +22,7 @@ test('toSafeInteger([]) returns 0', () => { test('isNaN(toSafeInteger([1.5, 3124])) is true', () => { expect(isNaN(toSafeInteger([1.5, 3124]))).toBeTruthy(); }); -test('isNaN(toSafeInteger(\'string\')) is true', () => { +test("isNaN(toSafeInteger('string')) is true", () => { expect(isNaN(toSafeInteger('string'))).toBeTruthy(); }); test('isNaN(toSafeInteger({})) is true', () => { @@ -38,5 +38,5 @@ 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(); + expect(end - start < 2000).toBeTruthy(); }); diff --git a/test/toSnakeCase/toSnakeCase.test.js b/test/toSnakeCase/toSnakeCase.test.js index 5c6ebdeb8..a07405ee0 100644 --- a/test/toSnakeCase/toSnakeCase.test.js +++ b/test/toSnakeCase/toSnakeCase.test.js @@ -4,33 +4,45 @@ const toSnakeCase = require('./toSnakeCase.js'); test('toSnakeCase is a Function', () => { expect(toSnakeCase).toBeInstanceOf(Function); }); -test('toSnakeCase(\'camelCase\') returns camel_case', () => { +test("toSnakeCase('camelCase') returns camel_case", () => { expect(toSnakeCase('camelCase')).toBe('camel_case'); }); -test('toSnakeCase(\'some text\') returns 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', () => { - 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('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()).toBe(undefined); }); test('toSnakeCase([]) throws an error', () => { - expect(() => {toSnakeCase([]);}).toThrow(); + expect(() => { + toSnakeCase([]); + }).toThrow(); }); test('toSnakeCase({}) throws an error', () => { - expect(() => {toSnakeCase({});}).toThrow(); + expect(() => { + toSnakeCase({}); + }).toThrow(); }); test('toSnakeCase(123) throws an error', () => { - expect(() => {toSnakeCase(123);}).toThrow(); + 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(); + expect(end - start < 2000).toBeTruthy(); }); diff --git a/test/transform/transform.test.js b/test/transform/transform.test.js index 54f940e4c..075e8345b 100644 --- a/test/transform/transform.test.js +++ b/test/transform/transform.test.js @@ -5,10 +5,14 @@ test('transform is a Function', () => { expect(transform).toBeInstanceOf(Function); }); test('Transforms an object', () => { - expect(transform( - { a: 1, b: 2, c: 1 }, - (r, v, k) => { - (r[v] || (r[v] = [])).push(k); - return r; - },{})).toEqual({ '1': ['a', 'c'], '2': ['b'] }); + expect( + transform( + { a: 1, b: 2, c: 1 }, + (r, v, k) => { + (r[v] || (r[v] = [])).push(k); + return r; + }, + {} + ) + ).toEqual({ '1': ['a', 'c'], '2': ['b'] }); }); diff --git a/test/truthCheckCollection/truthCheckCollection.test.js b/test/truthCheckCollection/truthCheckCollection.test.js index 8f8c89a0a..c25b5abdb 100644 --- a/test/truthCheckCollection/truthCheckCollection.test.js +++ b/test/truthCheckCollection/truthCheckCollection.test.js @@ -5,5 +5,10 @@ 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')).toBeTruthy(); + expect( + truthCheckCollection( + [{ user: 'Tinky-Winky', sex: 'male' }, { user: 'Dipsy', sex: 'male' }], + 'sex' + ) + ).toBeTruthy(); }); diff --git a/test/unary/unary.test.js b/test/unary/unary.test.js index 464c8173b..791924bfc 100644 --- a/test/unary/unary.test.js +++ b/test/unary/unary.test.js @@ -7,4 +7,3 @@ test('unary is a Function', () => { test('Discards arguments after the first one', () => { expect(['6', '8', '10'].map(unary(parseInt))).toEqual([6, 8, 10]); }); - diff --git a/test/uncurry/uncurry.test.js b/test/uncurry/uncurry.test.js index b94e3d1ff..8a5eb4751 100644 --- a/test/uncurry/uncurry.test.js +++ b/test/uncurry/uncurry.test.js @@ -12,8 +12,8 @@ test('Works without a provided value for n', () => { expect(add1(1)(2)(3)).toBe(6); }); test('Works with n = 2', () => { - expect(add2(1,2)(3)).toBe(6); + expect(add2(1, 2)(3)).toBe(6); }); - test('Works with n = 3', () => { - expect(add3(1,2,3)).toBe(6); +test('Works with n = 3', () => { + expect(add3(1, 2, 3)).toBe(6); }); diff --git a/test/unescapeHTML/unescapeHTML.test.js b/test/unescapeHTML/unescapeHTML.test.js index 6f5571384..10237de0b 100644 --- a/test/unescapeHTML/unescapeHTML.test.js +++ b/test/unescapeHTML/unescapeHTML.test.js @@ -5,5 +5,7 @@ test('unescapeHTML is a Function', () => { expect(unescapeHTML).toBeInstanceOf(Function); }); test('Unescapes escaped HTML characters.', () => { - expect(unescapeHTML('<a href="#">Me & you</a>')).toBe('Me & you'); + expect(unescapeHTML('<a href="#">Me & you</a>')).toBe( + 'Me & you' + ); }); diff --git a/test/union/union.test.js b/test/union/union.test.js index bf23e1805..40e0a690c 100644 --- a/test/union/union.test.js +++ b/test/union/union.test.js @@ -7,8 +7,8 @@ test('union is a Function', () => { test('union([1, 2, 3], [4, 3, 2]) returns [1, 2, 3, 4]', () => { expect(union([1, 2, 3], [4, 3, 2])).toEqual([1, 2, 3, 4]); }); -test('union(\'str\', \'asd\') returns [ \'s\', \'t\', \'r\', \'a\', \'d\' ]', () => { - expect(union('str', 'asd')).toEqual([ 's', 't', 'r', 'a', 'd' ]); +test("union('str', 'asd') returns [ 's', 't', 'r', 'a', 'd' ]", () => { + expect(union('str', 'asd')).toEqual(['s', 't', 'r', 'a', 'd']); }); test('union([[], {}], [1, 2, 3]) returns [[], {}, 1, 2, 3]', () => { expect(union([[], {}], [1, 2, 3])).toEqual([[], {}, 1, 2, 3]); @@ -17,26 +17,38 @@ test('union([], []) returns []', () => { expect(union([], [])).toEqual([]); }); test('union() throws an error', () => { - expect(() => {union(); }).toThrow(); + expect(() => { + union(); + }).toThrow(); }); -test('union(true, \'str\') throws an error', () => { - expect(() => {union(true, 'str'); }).toThrow(); +test("union(true, 'str') throws an error", () => { + expect(() => { + union(true, 'str'); + }).toThrow(); }); -test('union(\'false\', true) throws an error', () => { - expect(() => {union('false', true); }).toThrow(); +test("union('false', true) throws an error", () => { + expect(() => { + union('false', true); + }).toThrow(); }); test('union((123, {}) throws an error', () => { - expect(() => {union(123, {}); }).toThrow(); + expect(() => { + union(123, {}); + }).toThrow(); }); test('union([], {}) throws an error', () => { - expect(() => {union([], {}); }).toThrow(); + expect(() => { + union([], {}); + }).toThrow(); }); test('union(undefined, null) throws an error', () => { - expect(() => {union(undefined, null); }).toThrow(); + expect(() => { + union(undefined, null); + }).toThrow(); }); let start = new Date().getTime(); union([1, 2, 3], [4, 3, 2]); let end = new Date().getTime(); test('union([1, 2, 3], [4, 3, 2]) takes less than 2s to run', () => { - expect((end - start) < 2000).toBeTruthy(); + expect(end - start < 2000).toBeTruthy(); }); diff --git a/test/unionWith/unionWith.test.js b/test/unionWith/unionWith.test.js index d99c24835..4ad85edeb 100644 --- a/test/unionWith/unionWith.test.js +++ b/test/unionWith/unionWith.test.js @@ -5,5 +5,7 @@ test('unionWith is a Function', () => { expect(unionWith).toBeInstanceOf(Function); }); test('Produces the appropriate results', () => { - expect(unionWith([1, 1.2, 1.5, 3, 0], [1.9, 3, 0, 3.9], (a, b) => Math.round(a) === Math.round(b))).toEqual([1, 1.2, 1.5, 3, 0, 3.9]); + expect( + unionWith([1, 1.2, 1.5, 3, 0], [1.9, 3, 0, 3.9], (a, b) => Math.round(a) === Math.round(b)) + ).toEqual([1, 1.2, 1.5, 3, 0, 3.9]); }); diff --git a/test/uniqueElements/uniqueElements.test.js b/test/uniqueElements/uniqueElements.test.js index 7c659f2ed..9b28a5be9 100644 --- a/test/uniqueElements/uniqueElements.test.js +++ b/test/uniqueElements/uniqueElements.test.js @@ -1,18 +1,25 @@ const expect = require('expect'); const uniqueElements = require('./uniqueElements.js'); - test('uniqueElements is a Function', () => { expect(uniqueElements).toBeInstanceOf(Function); }); test('uniqueElements([1, 2, 2, 3, 4, 4, 5]) returns [1,2,3,4,5]', () => { - expect(uniqueElements([1, 2, 2, 3, 4, 4, 5])).toEqual([1,2,3,4,5]); + expect(uniqueElements([1, 2, 2, 3, 4, 4, 5])).toEqual([1, 2, 3, 4, 5]); }); test('uniqueElements([1, 23, 53]) returns [1, 23, 53]', () => { expect(uniqueElements([1, 23, 53])).toEqual([1, 23, 53]); }); -test('uniqueElements([true, 0, 1, false, false, undefined, null, \'\']) returns [true, 0, 1, false, false, undefined, null, \'\']', () => { - expect(uniqueElements([true, 0, 1, false, false, undefined, null, ''])).toEqual([true, 0, 1, false, undefined, null, '']); +test("uniqueElements([true, 0, 1, false, false, undefined, null, '']) returns [true, 0, 1, false, false, undefined, null, '']", () => { + expect(uniqueElements([true, 0, 1, false, false, undefined, null, ''])).toEqual([ + true, + 0, + 1, + false, + undefined, + null, + '' + ]); }); test('uniqueElements() returns []', () => { expect(uniqueElements()).toEqual([]); @@ -23,24 +30,32 @@ test('uniqueElements(null) returns []', () => { test('uniqueElements(undefined) returns []', () => { expect(uniqueElements(undefined)).toEqual([]); }); -test('uniqueElements(\'strt\') returns [\'s\', \'t\', \'r\']', () => { +test("uniqueElements('strt') returns ['s', 't', 'r']", () => { expect(uniqueElements('strt')).toEqual(['s', 't', 'r']); }); test('uniqueElements(1, 1, 2543, 534, 5) throws an error', () => { - expect(() => {uniqueElements(1, 1, 2543, 534, 5); }).toThrow(); + expect(() => { + uniqueElements(1, 1, 2543, 534, 5); + }).toThrow(); }); test('uniqueElements({}) throws an error', () => { - expect(() => {uniqueElements({}); }).toThrow(); + expect(() => { + uniqueElements({}); + }).toThrow(); }); test('uniqueElements(true) throws an error', () => { - expect(() => {uniqueElements(true); }).toThrow(); + expect(() => { + uniqueElements(true); + }).toThrow(); }); test('uniqueElements(false) throws an error', () => { - expect(() => {uniqueElements(false); }).toThrow(); + expect(() => { + uniqueElements(false); + }).toThrow(); }); let start = new Date().getTime(); uniqueElements([true, 0, 1, false, false, undefined, null, '']); let end = new Date().getTime(); test('uniqueElements([true, 0, 1, false, false, undefined, null]) takes less than 2s to run', () => { - expect((end - start) < 2000).toBeTruthy(); + expect(end - start < 2000).toBeTruthy(); }); diff --git a/test/uniqueElementsBy/uniqueElementsBy.test.js b/test/uniqueElementsBy/uniqueElementsBy.test.js index 1ed83a6e5..5ff75d831 100644 --- a/test/uniqueElementsBy/uniqueElementsBy.test.js +++ b/test/uniqueElementsBy/uniqueElementsBy.test.js @@ -6,27 +6,35 @@ test('uniqueElementsBy is a Function', () => { }); test('uniqueElementsBy works for properties', () => { - expect(uniqueElementsBy( - [ - { id: 0, value: 'a' }, - { id: 1, value: 'b' }, - { id: 2, value: 'c' }, - { id: 1, value: 'd' }, - { id: 0, value: 'e' }, - ], - (a, b) => a.id === b.id - )).toEqual([ { id: 0, value: 'a' }, { id: 1, value: 'b' }, { id: 2, value: 'c' } ]); + expect( + uniqueElementsBy( + [ + { id: 0, value: 'a' }, + { id: 1, value: 'b' }, + { id: 2, value: 'c' }, + { id: 1, value: 'd' }, + { id: 0, value: 'e' } + ], + (a, b) => a.id === b.id + ) + ).toEqual([{ id: 0, value: 'a' }, { id: 1, value: 'b' }, { id: 2, value: 'c' }]); }); test('uniqueElementsBy works for nested properties', () => { - expect(uniqueElementsBy( - [ - { id: 0, value: 'a', n: {p: 0} }, - { id: 1, value: 'b', n: {p: 1} }, - { id: 2, value: 'c', n: {p: 2} }, - { id: 1, value: 'd', n: {p: 0} }, - { id: 0, value: 'e', n: {p: 1} }, - ], - (a, b) => a.id === b.id - )).toEqual([ { id: 0, value: 'a', n: {p: 0} }, { id: 1, value: 'b', n: {p: 1} }, { id: 2, value: 'c', n: {p: 2} } ]); + expect( + uniqueElementsBy( + [ + { id: 0, value: 'a', n: { p: 0 } }, + { id: 1, value: 'b', n: { p: 1 } }, + { id: 2, value: 'c', n: { p: 2 } }, + { id: 1, value: 'd', n: { p: 0 } }, + { id: 0, value: 'e', n: { p: 1 } } + ], + (a, b) => a.id === b.id + ) + ).toEqual([ + { id: 0, value: 'a', n: { p: 0 } }, + { id: 1, value: 'b', n: { p: 1 } }, + { id: 2, value: 'c', n: { p: 2 } } + ]); }); diff --git a/test/uniqueElementsByRight/uniqueElementsByRight.test.js b/test/uniqueElementsByRight/uniqueElementsByRight.test.js index 0c1469184..9e324ef1f 100644 --- a/test/uniqueElementsByRight/uniqueElementsByRight.test.js +++ b/test/uniqueElementsByRight/uniqueElementsByRight.test.js @@ -6,27 +6,35 @@ test('uniqueElementsByRight is a Function', () => { }); test('uniqueElementsByRight works for properties', () => { - expect(uniqueElementsByRight( - [ - { id: 0, value: 'a' }, - { id: 1, value: 'b' }, - { id: 2, value: 'c' }, - { id: 1, value: 'd' }, - { id: 0, value: 'e' }, - ], - (a, b) => a.id === b.id - )).toEqual([ { id: 0, value: 'e' }, { id: 1, value: 'd' }, { id: 2, value: 'c' } ]); + expect( + uniqueElementsByRight( + [ + { id: 0, value: 'a' }, + { id: 1, value: 'b' }, + { id: 2, value: 'c' }, + { id: 1, value: 'd' }, + { id: 0, value: 'e' } + ], + (a, b) => a.id === b.id + ) + ).toEqual([{ id: 0, value: 'e' }, { id: 1, value: 'd' }, { id: 2, value: 'c' }]); }); test('uniqueElementsByRight works for nested properties', () => { - expect(uniqueElementsByRight( - [ - { id: 0, value: 'a', n: {p: 0} }, - { id: 1, value: 'b', n: {p: 1} }, - { id: 2, value: 'c', n: {p: 2} }, - { id: 1, value: 'd', n: {p: 0} }, - { id: 0, value: 'e', n: {p: 1} }, - ], - (a, b) => a.id === b.id - )).toEqual([ { id: 0, value: 'e', n: {p: 1} }, { id: 1, value: 'd', n: {p: 0} }, { id: 2, value: 'c', n: {p: 2} } ]); + expect( + uniqueElementsByRight( + [ + { id: 0, value: 'a', n: { p: 0 } }, + { id: 1, value: 'b', n: { p: 1 } }, + { id: 2, value: 'c', n: { p: 2 } }, + { id: 1, value: 'd', n: { p: 0 } }, + { id: 0, value: 'e', n: { p: 1 } } + ], + (a, b) => a.id === b.id + ) + ).toEqual([ + { id: 0, value: 'e', n: { p: 1 } }, + { id: 1, value: 'd', n: { p: 0 } }, + { id: 2, value: 'c', n: { p: 2 } } + ]); }); diff --git a/test/unzip/unzip.test.js b/test/unzip/unzip.test.js index 1d25cd38c..b8c67f6e7 100644 --- a/test/unzip/unzip.test.js +++ b/test/unzip/unzip.test.js @@ -4,9 +4,9 @@ const unzip = require('./unzip.js'); test('unzip is a Function', () => { expect(unzip).toBeInstanceOf(Function); }); -test('unzip([[\'a\', 1, true], [\'b\', 2, false]]) equals [[\'a\',\'b\'], [1, 2], [true, false]]', () => { +test("unzip([['a', 1, true], ['b', 2, false]]) equals [['a','b'], [1, 2], [true, false]]", () => { expect(unzip([['a', 1, true], ['b', 2, false]])).toEqual([['a', 'b'], [1, 2], [true, false]]); }); -test('unzip([[\'a\', 1, true], [\'b\', 2]]) equals [[\'a\',\'b\'], [1, 2], [true]]', () => { +test("unzip([['a', 1, true], ['b', 2]]) equals [['a','b'], [1, 2], [true]]", () => { expect(unzip([['a', 1, true], ['b', 2]])).toEqual([['a', 'b'], [1, 2], [true]]); }); diff --git a/test/unzipWith/unzipWith.test.js b/test/unzipWith/unzipWith.test.js index 40e0fbacd..8a439000c 100644 --- a/test/unzipWith/unzipWith.test.js +++ b/test/unzipWith/unzipWith.test.js @@ -5,5 +5,7 @@ test('unzipWith is a Function', () => { expect(unzipWith).toBeInstanceOf(Function); }); test('unzipWith([[1, 10, 100], [2, 20, 200]], (...args) => args.reduce((acc, v) => acc + v, 0)) equals [3, 30, 300]', () => { - expect(unzipWith([[1, 10, 100], [2, 20, 200]], (...args) => args.reduce((acc, v) => acc + v, 0))).toEqual([3, 30, 300]); + expect( + unzipWith([[1, 10, 100], [2, 20, 200]], (...args) => args.reduce((acc, v) => acc + v, 0)) + ).toEqual([3, 30, 300]); }); diff --git a/test/when/when.test.js b/test/when/when.test.js index 0feb021e8..5ea4c3baf 100644 --- a/test/when/when.test.js +++ b/test/when/when.test.js @@ -4,10 +4,7 @@ const when = require('./when.js'); test('when is a Function', () => { expect(when).toBeInstanceOf(Function); }); -const doubleEvenNumbers = when( - (x) => x % 2 === 0, - (x) => x * 2 -); +const doubleEvenNumbers = when(x => x % 2 === 0, x => x * 2); test('Returns the proper result', () => { expect(doubleEvenNumbers(2)).toBe(4); }); diff --git a/test/without/without.test.js b/test/without/without.test.js index 38711423e..21a9684df 100644 --- a/test/without/without.test.js +++ b/test/without/without.test.js @@ -10,24 +10,34 @@ test('without([2, 1, 2, 3], 1, 2) returns [3]', () => { test('without([]) returns []', () => { expect(without([])).toEqual([]); }); -test('without([3, 1, true, \'3\', true], \'3\', true) returns [3, 1]', () => { +test("without([3, 1, true, '3', true], '3', true) returns [3, 1]", () => { expect(without([3, 1, true, '3', true], '3', true)).toEqual([3, 1]); }); -test('without(\'string\'.split(\'\'), \'s\', \'t\', \'g\') returns [\'r\', \'i\', \'n\']', () => { +test("without('string'.split(''), 's', 't', 'g') returns ['r', 'i', 'n']", () => { expect(without('string'.split(''), 's', 't', 'g')).toEqual(['r', 'i', 'n']); }); test('without() throws an error', () => { - expect(() => { without(); }).toThrow(); + expect(() => { + without(); + }).toThrow(); }); test('without(null) throws an error', () => { - expect(() => { without(null); }).toThrow(); + expect(() => { + without(null); + }).toThrow(); }); test('without(undefined) throws an error', () => { - expect(() => { without(undefined); }).toThrow(); + expect(() => { + without(undefined); + }).toThrow(); }); test('without(123) throws an error', () => { - expect(() => { without(123); }).toThrow(); + expect(() => { + without(123); + }).toThrow(); }); test('without({}) throws an error', () => { - expect(() => { without({}); }).toThrow(); + expect(() => { + without({}); + }).toThrow(); }); diff --git a/test/words/words.test.js b/test/words/words.test.js index ff64ef83b..4ed2c9e9f 100644 --- a/test/words/words.test.js +++ b/test/words/words.test.js @@ -4,30 +4,42 @@ const words = require('./words.js'); test('words is a Function', () => { expect(words).toBeInstanceOf(Function); }); -test('words(\'I love javaScript!!\') returns [I, love, javaScript]', () => { - expect(words('I love javaScript!!')).toEqual(["I", "love", "javaScript"]); +test("words('I love javaScript!!') returns [I, love, javaScript]", () => { + expect(words('I love javaScript!!')).toEqual(['I', 'love', 'javaScript']); }); -test('words(\'python, javaScript & coffee\') returns [python, javaScript, coffee]', () => { - expect(words('python, javaScript & coffee')).toEqual(["python", "javaScript", "coffee"]); +test("words('python, javaScript & coffee') returns [python, javaScript, coffee]", () => { + expect(words('python, javaScript & coffee')).toEqual(['python', 'javaScript', 'coffee']); }); test('words(I love javaScript!!) returns an array', () => { expect(Array.isArray(words('I love javaScript!!'))).toBeTruthy(); }); test('words() throws an error', () => { - expect(() => { words(); }).toThrow(); + expect(() => { + words(); + }).toThrow(); }); test('words(null) throws an error', () => { - expect(() => { words(null); }).toThrow(); + expect(() => { + words(null); + }).toThrow(); }); test('words(undefined) throws an error', () => { - expect(() => { words(undefined); }).toThrow(); + expect(() => { + words(undefined); + }).toThrow(); }); test('words({}) throws an error', () => { - expect(() => { words({}); }).toThrow(); + expect(() => { + words({}); + }).toThrow(); }); test('words([]) throws an error', () => { - expect(() => { words([]); }).toThrow(); + expect(() => { + words([]); + }).toThrow(); }); test('words(1234) throws an error', () => { - expect(() => { words(1234); }).toThrow(); + expect(() => { + words(1234); + }).toThrow(); }); diff --git a/test/xProd/xProd.test.js b/test/xProd/xProd.test.js index c4cea5de1..2b6f00116 100644 --- a/test/xProd/xProd.test.js +++ b/test/xProd/xProd.test.js @@ -4,6 +4,6 @@ const xProd = require('./xProd.js'); test('xProd is a Function', () => { expect(xProd).toBeInstanceOf(Function); }); -test('xProd([1, 2], [\'a\', \'b\']) returns [[1, \'a\'], [1, \'b\'], [2, \'a\'], [2, \'b\']]', () => { +test("xProd([1, 2], ['a', 'b']) returns [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']]", () => { expect(xProd([1, 2], ['a', 'b'])).toEqual([[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']]); }); diff --git a/test/zip/zip.test.js b/test/zip/zip.test.js index 270554046..90a291cb2 100644 --- a/test/zip/zip.test.js +++ b/test/zip/zip.test.js @@ -1,7 +1,6 @@ const expect = require('expect'); const zip = require('./zip.js'); - test('zip is a Function', () => { expect(zip).toBeInstanceOf(Function); }); @@ -24,8 +23,12 @@ test('zip([a], [1, 2], [true, false]) returns an Array', () => { expect(Array.isArray(zip(['a'], [1, 2], [true, false]))).toBeTruthy(); }); test('zip(null) throws an error', () => { - expect(() => {zip(null);}).toThrow(); + expect(() => { + zip(null); + }).toThrow(); }); test('zip(undefined) throws an error', () => { - expect(() => {zip(undefined);}).toThrow(); + expect(() => { + zip(undefined); + }).toThrow(); }); diff --git a/test/zipObject/zipObject.test.js b/test/zipObject/zipObject.test.js index 2a10a9f0f..abdc07d77 100644 --- a/test/zipObject/zipObject.test.js +++ b/test/zipObject/zipObject.test.js @@ -5,10 +5,10 @@ test('zipObject is a Function', () => { expect(zipObject).toBeInstanceOf(Function); }); test('zipObject([a, b, c], [1, 2]) returns {a: 1, b: 2, c: undefined}', () => { - expect(zipObject(['a', 'b', 'c'], [1, 2])).toEqual({a: 1, b: 2, c: undefined}); + expect(zipObject(['a', 'b', 'c'], [1, 2])).toEqual({ a: 1, b: 2, c: undefined }); }); test('zipObject([a, b], [1, 2, 3]) returns {a: 1, b: 2}', () => { - expect(zipObject(['a', 'b'], [1, 2, 3])).toEqual({a: 1, b: 2}); + expect(zipObject(['a', 'b'], [1, 2, 3])).toEqual({ a: 1, b: 2 }); }); test('zipObject([a, b, c], string) returns { a: s, b: t, c: r }', () => { expect(zipObject(['a', 'b', 'c'], 'string')).toEqual({ a: 's', b: 't', c: 'r' }); @@ -17,17 +17,27 @@ test('zipObject([a], string) returns { a: s }', () => { expect(zipObject(['a'], 'string')).toEqual({ a: 's' }); }); test('zipObject() throws an error', () => { - expect(() => {zipObject();}).toThrow(); + expect(() => { + zipObject(); + }).toThrow(); }); -test('zipObject(([\'string\'], null) throws an error', () => { - expect(() => {zipObject(['string'], null);}).toThrow(); +test("zipObject((['string'], null) throws an error", () => { + expect(() => { + zipObject(['string'], null); + }).toThrow(); }); test('zipObject(null, [1]) throws an error', () => { - expect(() => {zipObject(null, [1]);}).toThrow(); + expect(() => { + zipObject(null, [1]); + }).toThrow(); }); -test('zipObject(\'string\') throws an error', () => { - expect(() => {zipObject('string');}).toThrow(); +test("zipObject('string') throws an error", () => { + expect(() => { + zipObject('string'); + }).toThrow(); }); -test('zipObject(\'test\', \'string\') throws an error', () => { - expect(() => {zipObject('test', 'string');}).toThrow(); +test("zipObject('test', 'string') throws an error", () => { + expect(() => { + zipObject('test', 'string'); + }).toThrow(); });