diff --git a/test/mapKeys/mapKeys.test.js b/test/mapKeys/mapKeys.test.js index cec228c64..076f1fabe 100644 --- a/test/mapKeys/mapKeys.test.js +++ b/test/mapKeys/mapKeys.test.js @@ -1,12 +1,9 @@ const expect = require('expect'); const mapKeys = require('./mapKeys.js'); - - test('mapKeys is a Function', () => { +test('mapKeys is a Function', () => { expect(mapKeys).toBeInstanceOf(Function); }); - test('Maps keys', () => { - expect(mapKeys({ a: 1, b: 2 }, (val, key) => key + val), { a1: 1, b2: 2 }).toEqual() +test('Maps keys', () => { + expect(mapKeys({ a: 1, b: 2 }, (val, key) => key + val)).toEqual({ a1: 1, b2: 2 }); }); - - diff --git a/test/mapObject/mapObject.test.js b/test/mapObject/mapObject.test.js index ea3d2fd08..86d5cf698 100644 --- a/test/mapObject/mapObject.test.js +++ b/test/mapObject/mapObject.test.js @@ -1,18 +1,15 @@ const expect = require('expect'); const mapObject = require('./mapObject.js'); - - test('mapObject is a Function', () => { +test('mapObject is a Function', () => { expect(mapObject).toBeInstanceOf(Function); }); - test('mapObject([1, 2, 3], a => a * a) returns { 1: 1, 2: 4, 3: 9 }', () => { - expect(mapObject([1, 2, 3], a => a * a), { 1: 1, 2: 4).toEqual(3: 9 }) +test('mapObject([1, 2, 3], a => a * a) returns { 1: 1, 2: 4, 3: 9 }', () => { + expect(mapObject([1, 2, 3], a => a * a)).toEqual({ 1: 1, 2: 4, 3: 9 }); }); - test('mapObject([1, 2, 3, 4], (a, b) => b - a) returns { 1: -1, 2: -1, 3: -1, 4: -1 }', () => { - expect(mapObject([1, 2, 3, 4], (a, b) => b - a), { 1: -1, 2: -1, 3: -1, 4: -1 }).toEqual() +test('mapObject([1, 2, 3, 4], (a, b) => b - a) returns { 1: -1, 2: -1, 3: -1, 4: -1 }', () => { + expect(mapObject([1, 2, 3, 4], (a, b) => b - a)).toEqual({ 1: -1, 2: -1, 3: -1, 4: -1 }); }); - test('mapObject([1, 2, 3, 4], (a, b) => a - b) returns { 1: 1, 2: 1, 3: 1, 4: 1 }', () => { - expect(mapObject([1, 2, 3, 4], (a, b) => a - b), { 1: 1, 2: 1, 3: 1, 4: 1 }).toEqual() +test('mapObject([1, 2, 3, 4], (a, b) => a - b) returns { 1: 1, 2: 1, 3: 1, 4: 1 }', () => { + expect(mapObject([1, 2, 3, 4], (a, b) => a - b)).toEqual({ 1: 1, 2: 1, 3: 1, 4: 1 }); }); - - diff --git a/test/mapValues/mapValues.test.js b/test/mapValues/mapValues.test.js index f8b315256..24273703c 100644 --- a/test/mapValues/mapValues.test.js +++ b/test/mapValues/mapValues.test.js @@ -1,16 +1,13 @@ const expect = require('expect'); const mapValues = require('./mapValues.js'); - - test('mapValues is a Function', () => { +test('mapValues is a Function', () => { expect(mapValues).toBeInstanceOf(Function); }); - const users = { - fred: { user: 'fred', age: 40 }, - pebbles: { user: 'pebbles', age: 1 } - }; - test('Maps values', () => { - expect(mapValues(users, u => u.age), { fred: 40, pebbles: 1 }).toEqual() +const users = { + fred: { user: 'fred', age: 40 }, + pebbles: { user: 'pebbles', age: 1 } +}; +test('Maps values', () => { + expect(mapValues(users, u => u.age)).toEqual({ fred: 40, pebbles: 1 }); }); - - diff --git a/test/mask/mask.test.js b/test/mask/mask.test.js index 16a590dd5..11c8e4cb5 100644 --- a/test/mask/mask.test.js +++ b/test/mask/mask.test.js @@ -1,17 +1,15 @@ const expect = require('expect'); const mask = require('./mask.js'); - - test('mask is a Function', () => { +test('mask is a Function', () => { expect(mask).toBeInstanceOf(Function); }); - test('Replaces all but the last num of characters with the specified mask character', () => { - expect(mask(1234567890)).toBe('******7890') +test('Replaces all but the last num of characters with the specified mask character', () => { + expect(mask(1234567890)).toBe('******7890'); }); - test('Replaces all but the last num of characters with the specified mask character', () => { - expect(mask(1234567890, 3)).toBe('*******890') +test('Replaces all but the last num of characters with the specified mask character', () => { + expect(mask(1234567890, 3)).toBe('*******890'); }); - test('Replaces all but the last num of characters with the specified mask character', () => { - expect(mask(1234567890, -4, '$')).toBe('$$$$567890') +test('Replaces all but the last num of characters with the specified mask character', () => { + expect(mask(1234567890, -4, '$')).toBe('$$$$567890'); }); - diff --git a/test/matches/matches.test.js b/test/matches/matches.test.js index e0e33998d..221c9d950 100644 --- a/test/matches/matches.test.js +++ b/test/matches/matches.test.js @@ -1,15 +1,12 @@ const expect = require('expect'); const matches = require('./matches.js'); - - test('matches is a Function', () => { +test('matches is a Function', () => { expect(matches).toBeInstanceOf(Function); }); - test('Matches returns true for two similar objects', () => { +test('Matches returns true for two similar objects', () => { expect(matches({ age: 25, hair: 'long', beard: true }, { hair: 'long', beard: true })).toBeTruthy(); }); - test('Matches returns false for two non-similar objects', () => { +test('Matches returns false for two non-similar objects', () => { 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 d463b7817..5de34f836 100644 --- a/test/matchesWith/matchesWith.test.js +++ b/test/matchesWith/matchesWith.test.js @@ -1,15 +1,14 @@ const expect = require('expect'); const matchesWith = require('./matchesWith.js'); - - test('matchesWith is a Function', () => { +test('matchesWith is a Function', () => { expect(matchesWith).toBeInstanceOf(Function); }); - const isGreeting = val => /^h(?:i|ello)$/.test(val); - t.true(matchesWith( +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) - ), 'Returns true for two objects with similar values, based on the provided function'); - - + )).toBeTruthy(); +}); diff --git a/test/maxBy/maxBy.test.js b/test/maxBy/maxBy.test.js index b9866da4b..2cd581553 100644 --- a/test/maxBy/maxBy.test.js +++ b/test/maxBy/maxBy.test.js @@ -1,15 +1,12 @@ const expect = require('expect'); const maxBy = require('./maxBy.js'); - - test('maxBy is a Function', () => { +test('maxBy is a Function', () => { expect(maxBy).toBeInstanceOf(Function); }); - test('Produces the right result with a function', () => { - expect(maxBy([{ n: 4 }, { n: 2 }, { n: 8 }, { n: 6 }], o => o.n), 8).toBe() +test('Produces the right result with a function', () => { + expect(maxBy([{ n: 4 }, { n: 2 }, { n: 8 }, { n: 6 }], o => o.n)).toBe(8); }); - test('Produces the right result with a property name', () => { - expect(maxBy([{ n: 4 }, { n: 2 }, { n: 8 }, { n: 6 }], 'n'), 8).toBe() +test('Produces the right result with a property name', () => { + expect(maxBy([{ n: 4 }, { n: 2 }, { n: 8 }, { n: 6 }], 'n')).toBe(8); }); - - diff --git a/test/maxN/maxN.test.js b/test/maxN/maxN.test.js index ca4af723c..ab64c28bb 100644 --- a/test/maxN/maxN.test.js +++ b/test/maxN/maxN.test.js @@ -1,14 +1,12 @@ const expect = require('expect'); const maxN = require('./maxN.js'); - - test('maxN is a Function', () => { +test('maxN is a Function', () => { expect(maxN).toBeInstanceOf(Function); }); - test('Returns the n maximum elements from the provided array', () => { - expect(maxN([1, 2, 3])).toEqual([3]) +test('Returns the n maximum elements from the provided array', () => { + expect(maxN([1, 2, 3])).toEqual([3])l }); - test('Returns the n maximum elements from the provided array', () => { - expect(maxN([1, 2, 3], 2), [3).toEqual(2]) +test('Returns the n maximum elements from the provided array', () => { + expect(maxN([1, 2, 3], 2)).toEqual([3, 2])l }); - diff --git a/test/median/median.test.js b/test/median/median.test.js index 0d330d0f0..1852a9910 100644 --- a/test/median/median.test.js +++ b/test/median/median.test.js @@ -1,14 +1,12 @@ const expect = require('expect'); const median = require('./median.js'); - - test('median is a Function', () => { +test('median is a Function', () => { expect(median).toBeInstanceOf(Function); }); - test('Returns the median of an array of numbers', () => { +test('Returns the median of an array of numbers', () => { expect(median([5, 6, 50, 1, -5])).toBe(5) }); - test('Returns the median of an array of numbers', () => { +test('Returns the median of an array of numbers', () => { expect(median([1, 2, 3])).toBe(2) }); - diff --git a/test/memoize/memoize.test.js b/test/memoize/memoize.test.js index 1d7bf83e1..ec8b0ca9e 100644 --- a/test/memoize/memoize.test.js +++ b/test/memoize/memoize.test.js @@ -1,20 +1,17 @@ const expect = require('expect'); const memoize = require('./memoize.js'); - - test('memoize is a Function', () => { +test('memoize is a Function', () => { expect(memoize).toBeInstanceOf(Function); }); - const f = x => x * x; - const square = memoize(f); - test('Function works properly', () => { - expect(square(2), 4).toBe() +const f = x => x * x; +const square = memoize(f); +test('Function works properly', () => { + expect(square(2)).toBe(4); }); - test('Function works properly', () => { - expect(square(3), 9).toBe() +test('Function works properly', () => { + expect(square(3)).toBe(9); }); - test('Cache stores values', () => { - expect(Array.from(square.cache), [[2,4],[3,9]]).toEqual() +test('Cache stores values', () => { + 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 34ebec62f..e46ac3b4b 100644 --- a/test/merge/merge.test.js +++ b/test/merge/merge.test.js @@ -1,21 +1,18 @@ const expect = require('expect'); const merge = require('./merge.js'); - - test('merge is a Function', () => { +test('merge is a Function', () => { expect(merge).toBeInstanceOf(Function); }); - const object = { - a: [{ x: 2 }, { y: 4 }], - b: 1 - }; - const other = { - a: { z: 3 }, - b: [2, 3], - c: 'foo' - }; - test('Merges two objects', () => { - expect(merge(object, other), { a: [ { x: 2 }, { y: 4 }, { z: 3 } ], b: [ 1, 2, 3 ], c: 'foo' }).toEqual() +const object = { + a: [{ x: 2 }, { y: 4 }], + b: 1 +}; +const other = { + a: { z: 3 }, + b: [2, 3], + c: 'foo' +}; +test('Merges two objects', () => { + expect(merge(object, other)).toEqual({ a: [ { x: 2 }, { y: 4 }, { z: 3 } ], b: [ 1, 2, 3 ], c: 'foo' }); }); - - diff --git a/test/minBy/minBy.test.js b/test/minBy/minBy.test.js index dfd8ba57a..82a1beeed 100644 --- a/test/minBy/minBy.test.js +++ b/test/minBy/minBy.test.js @@ -1,15 +1,12 @@ const expect = require('expect'); const minBy = require('./minBy.js'); - - test('minBy is a Function', () => { +test('minBy is a Function', () => { expect(minBy).toBeInstanceOf(Function); }); - test('Produces the right result with a function', () => { - expect(minBy([{ n: 4 }, { n: 2 }, { n: 8 }, { n: 6 }], o => o.n), 2).toBe() +test('Produces the right result with a function', () => { + expect(minBy([{ n: 4 }, { n: 2 }, { n: 8 }, { n: 6 }], o => o.n)).toBe(2); }); - test('Produces the right result with a property name', () => { - expect(minBy([{ n: 4 }, { n: 2 }, { n: 8 }, { n: 6 }], 'n'), 2).toBe() +test('Produces the right result with a property name', () => { + expect(minBy([{ n: 4 }, { n: 2 }, { n: 8 }, { n: 6 }], 'n')).toBe(2); }); - - diff --git a/test/minN/minN.test.js b/test/minN/minN.test.js index 2475ac45b..dd4269711 100644 --- a/test/minN/minN.test.js +++ b/test/minN/minN.test.js @@ -1,14 +1,12 @@ const expect = require('expect'); const minN = require('./minN.js'); - - test('minN is a Function', () => { +test('minN is a Function', () => { expect(minN).toBeInstanceOf(Function); }); - 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])).toEqual([1]); }); - test('Returns the n minimum elements from the provided array', () => { - expect(minN([1, 2, 3], 2), [1).toEqual(2]) +test('Returns the n minimum elements from the provided array', () => { + expect(minN([1, 2, 3], 2), ).toEqual([1, 2]); }); - diff --git a/test/mostPerformant/mostPerformant.test.js b/test/mostPerformant/mostPerformant.test.js index 934e8667b..877fcdfa8 100644 --- a/test/mostPerformant/mostPerformant.test.js +++ b/test/mostPerformant/mostPerformant.test.js @@ -1,10 +1,6 @@ const expect = require('expect'); const mostPerformant = require('./mostPerformant.js'); - - test('mostPerformant is a Function', () => { +test('mostPerformant is a Function', () => { expect(mostPerformant).toBeInstanceOf(Function); }); - - - diff --git a/test/negate/negate.test.js b/test/negate/negate.test.js index 8166c7634..7dfd8b080 100644 --- a/test/negate/negate.test.js +++ b/test/negate/negate.test.js @@ -1,12 +1,9 @@ const expect = require('expect'); const negate = require('./negate.js'); - - test('negate is a Function', () => { +test('negate is a Function', () => { expect(negate).toBeInstanceOf(Function); }); - test('Negates a predicate function', () => { - expect([1, 2, 3, 4, 5, 6].filter(negate(n => n % 2 === 0)), [1, 3).toEqual(5]) +test('Negates a predicate function', () => { + expect([1, 2, 3, 4, 5, 6].filter(negate(n => n % 2 === 0))).toEqual([1, 3, 5]); }); - - diff --git a/test/nest/nest.test.js b/test/nest/nest.test.js index 65649a3c8..894a17001 100644 --- a/test/nest/nest.test.js +++ b/test/nest/nest.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const nest = require('./nest.js'); - - test('nest is a Function', () => { +test('nest is a Function', () => { expect(nest).toBeInstanceOf(Function); }); - diff --git a/test/nodeListToArray/nodeListToArray.test.js b/test/nodeListToArray/nodeListToArray.test.js index 175ce6cc7..414565976 100644 --- a/test/nodeListToArray/nodeListToArray.test.js +++ b/test/nodeListToArray/nodeListToArray.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const nodeListToArray = require('./nodeListToArray.js'); - - test('nodeListToArray is a Function', () => { +test('nodeListToArray is a Function', () => { expect(nodeListToArray).toBeInstanceOf(Function); }); - diff --git a/test/none/none.test.js b/test/none/none.test.js index 89a701c87..f46e207b0 100644 --- a/test/none/none.test.js +++ b/test/none/none.test.js @@ -1,21 +1,18 @@ const expect = require('expect'); const none = require('./none.js'); - - test('none is a Function', () => { +test('none is a Function', () => { expect(none).toBeInstanceOf(Function); }); - test('Returns true for arrays with no truthy values', () => { +test('Returns true for arrays with no truthy values', () => { expect(none([0,undefined,NaN,null,''])).toBeTruthy(); }); - test('Returns false for arrays with at least one truthy value', () => { +test('Returns false for arrays with at least one truthy value', () => { expect(none([0,1])).toBeFalsy(); }); - test('Returns true with a predicate function', () => { +test('Returns true with a predicate function', () => { expect(none([4,1,0,3], x => x < 0)).toBeTruthy(); }); - test('Returns false with predicate function', () => { +test('Returns false with predicate function', () => { expect(none([0,1,2], x => x === 1)).toBeFalsy(); }); - - diff --git a/test/nthArg/nthArg.test.js b/test/nthArg/nthArg.test.js index 1fe0d7568..621f91dac 100644 --- a/test/nthArg/nthArg.test.js +++ b/test/nthArg/nthArg.test.js @@ -1,20 +1,18 @@ const expect = require('expect'); const nthArg = require('./nthArg.js'); - - test('nthArg is a Function', () => { +test('nthArg is a Function', () => { expect(nthArg).toBeInstanceOf(Function); }); - const third = nthArg(2); - test('Returns the nth argument', () => { - expect(third(1, 2, 3), 3).toBe() +const third = nthArg(2); +test('Returns the nth argument', () => { + expect(third(1, 2, 3)).toBe(3); }); - test('Returns undefined if arguments too few', () => { - expect(third(1, 2), undefined).toBe() +test('Returns undefined if arguments too few', () => { + expect(third(1, 2)).toBe(undefined); }); - const last = nthArg(-1); - test('Works for negative values', () => { - expect(last(1, 2, 3, 4, 5), 5).toBe() +const last = nthArg(-1); +test('Works for negative values', () => { + expect(last(1, 2, 3, 4, 5)).toBe(5); }); - diff --git a/test/nthElement/nthElement.test.js b/test/nthElement/nthElement.test.js index 67bde724d..774de6f78 100644 --- a/test/nthElement/nthElement.test.js +++ b/test/nthElement/nthElement.test.js @@ -1,14 +1,12 @@ const expect = require('expect'); const nthElement = require('./nthElement.js'); - - test('nthElement is a Function', () => { +test('nthElement is a Function', () => { expect(nthElement).toBeInstanceOf(Function); }); - test('Returns the nth element of an array.', () => { - expect(nthElement(['a', 'b', 'c'], 1)).toBe('b') +test('Returns the nth element of an array.', () => { + expect(nthElement(['a', 'b', 'c'], 1)).toBe('b'); }); - test('Returns the nth element of an array.', () => { - expect(nthElement(['a', 'b', 'c'], -3)).toBe('a') +test('Returns the nth element of an array.', () => { + expect(nthElement(['a', 'b', 'c'], -3)).toBe('a'); }); -