diff --git a/test/JSONToFile/JSONToFile.test.js b/test/JSONToFile/JSONToFile.test.js index cdec2fda6..b46ee2c31 100644 --- a/test/JSONToFile/JSONToFile.test.js +++ b/test/JSONToFile/JSONToFile.test.js @@ -5,6 +5,6 @@ const JSONToFile = require('./JSONToFile.js'); test('JSONToFile is a Function', () => { expect(JSONToFile).toBeInstanceOf(Function); }); - t.pass('Tested on 09/02/2018 by @chalarangelo'); + diff --git a/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.test.js b/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.test.js index cf2376860..4448c0449 100644 --- a/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.test.js +++ b/test/UUIDGeneratorBrowser/UUIDGeneratorBrowser.test.js @@ -5,6 +5,6 @@ const UUIDGeneratorBrowser = require('./UUIDGeneratorBrowser.js'); test('UUIDGeneratorBrowser is a Function', () => { expect(UUIDGeneratorBrowser).toBeInstanceOf(Function); }); - t.pass('Tested 09/02/2018 by @chalarangelo'); + diff --git a/test/UUIDGeneratorNode/UUIDGeneratorNode.test.js b/test/UUIDGeneratorNode/UUIDGeneratorNode.test.js index 85ebf8b53..5aec30a90 100644 --- a/test/UUIDGeneratorNode/UUIDGeneratorNode.test.js +++ b/test/UUIDGeneratorNode/UUIDGeneratorNode.test.js @@ -6,7 +6,9 @@ const UUIDGeneratorNode = require('./UUIDGeneratorNode.js'); expect(UUIDGeneratorNode).toBeInstanceOf(Function); }); const uuid = UUIDGeneratorNode(); - t.deepEqual([uuid[8], uuid[13], uuid[18], uuid[23]], ['-', '-', '-', '-'], 'Contains dashes in the proper places'); + test('Contains dashes in the proper places', () => { + expect([uuid[8], uuid[13], uuid[18], uuid[23]], ['-', '-', '-', '-']).toEqual() +}); test('Only contains hexadecimal digits', () => { expect(/^[0-9A-Fa-f-]+$/.test(uuid)).toBeTruthy(); }); diff --git a/test/approximatelyEqual/approximatelyEqual.test.js b/test/approximatelyEqual/approximatelyEqual.test.js index 87272be4e..12cd74a82 100644 --- a/test/approximatelyEqual/approximatelyEqual.test.js +++ b/test/approximatelyEqual/approximatelyEqual.test.js @@ -1,21 +1,18 @@ const expect = require('expect'); const approximatelyEqual = require('./approximatelyEqual.js'); - - test('approximatelyEqual is a Function', () => { +test('approximatelyEqual is a Function', () => { expect(approximatelyEqual).toBeInstanceOf(Function); }); - test('Works for PI / 2', () => { +test('Works for PI / 2', () => { expect(approximatelyEqual(Math.PI / 2.0 , 1.5708)).toBeTruthy(); }); - test('Works for 0.1 + 0.2 === 0.3', () => { +test('Works for 0.1 + 0.2 === 0.3', () => { expect(approximatelyEqual(0.1 + 0.2, 0.3)).toBeTruthy(); }); - test('Works for exactly equal values', () => { +test('Works for exactly equal values', () => { expect(approximatelyEqual(0.5, 0.5)).toBeTruthy(); }); - test('Works for a custom epsilon', () => { +test('Works for a custom epsilon', () => { expect(approximatelyEqual(0.501, 0.5, 0.1)).toBeTruthy(); }); - - diff --git a/test/arrayToHtmlList/arrayToHtmlList.test.js b/test/arrayToHtmlList/arrayToHtmlList.test.js index 33ad61cae..07a97dcf8 100644 --- a/test/arrayToHtmlList/arrayToHtmlList.test.js +++ b/test/arrayToHtmlList/arrayToHtmlList.test.js @@ -1,10 +1,6 @@ const expect = require('expect'); const arrayToHtmlList = require('./arrayToHtmlList.js'); - - test('arrayToHtmlList is a Function', () => { +test('arrayToHtmlList is a Function', () => { expect(arrayToHtmlList).toBeInstanceOf(Function); }); - t.pass('Tested by @chalarangelo on 16/02/2018'); - - diff --git a/test/ary/ary.test.js b/test/ary/ary.test.js index 45ada26a6..e695ca124 100644 --- a/test/ary/ary.test.js +++ b/test/ary/ary.test.js @@ -1,13 +1,10 @@ const expect = require('expect'); const ary = require('./ary.js'); - - test('ary is a Function', () => { +test('ary is a Function', () => { expect(ary).toBeInstanceOf(Function); }); - const firstTwoMax = ary(Math.max, 2); - test('Discards arguments with index >=n', () => { - expect([[2, 6, 'a'], [8, 4, 6], [10]].map(x => firstTwoMax(...x)), [6, 8, 10]).toEqual() +const firstTwoMax = ary(Math.max, 2); +test('Discards arguments with index >=n', () => { + expect([[2, 6, 'a'], [8, 4, 6], [10]].map(x => firstTwoMax(...x))).toEqual([6, 8, 10]); }); - - diff --git a/test/atob/atob.test.js b/test/atob/atob.test.js index 4032a531a..43c4f1386 100644 --- a/test/atob/atob.test.js +++ b/test/atob/atob.test.js @@ -1,15 +1,12 @@ const expect = require('expect'); const atob = require('./atob.js'); - - test('atob is a Function', () => { +test('atob is a Function', () => { expect(atob).toBeInstanceOf(Function); }); - test('atob("Zm9vYmFy") equals "foobar"', () => { - expect(atob('Zm9vYmFy'), 'foobar').toBe() +test('atob("Zm9vYmFy") equals "foobar"', () => { + expect(atob('Zm9vYmFy')).toBe('foobar'); }); - test('atob("Z") returns ""', () => { - expect(atob('Z'), '').toBe() +test('atob("Z") returns ""', () => { + expect(atob('Z')).toBe(''); }); - - diff --git a/test/attempt/attempt.test.js b/test/attempt/attempt.test.js index 1bd0179da..047cfd4e7 100644 --- a/test/attempt/attempt.test.js +++ b/test/attempt/attempt.test.js @@ -1,15 +1,12 @@ const expect = require('expect'); const attempt = require('./attempt.js'); - - test('attempt is a Function', () => { +test('attempt is a Function', () => { expect(attempt).toBeInstanceOf(Function); }); - test('Returns a value', () => { - expect(attempt(() => 0), 0).toBe() +test('Returns a value', () => { + expect(attempt(() => 0)).toBe(0); }); - test('Returns an error', () => { - expect(attempt(() => {throw new Error();}) instanceof Error).toBeTruthy(); +test('Returns an error', () => { + expect(attempt(() => {throw new Error();})).toBeInstanceOf(Error); }); - - diff --git a/test/average/average.test.js b/test/average/average.test.js index 039daaba6..fe042cf36 100644 --- a/test/average/average.test.js +++ b/test/average/average.test.js @@ -1,37 +1,43 @@ const expect = require('expect'); const average = require('./average.js'); - - test('average is a Function', () => { +test('average is a Function', () => { expect(average).toBeInstanceOf(Function); }); - test('average(true) returns 0', () => { +test('average(true) returns 0', () => { expect(average(true) === 1).toBeTruthy(); }); - test('average(false) returns 1', () => { +test('average(false) returns 1', () => { expect(average(false) === 0).toBeTruthy(); }); - t.equal(average(9, 1), 5, 'average(9, 1) returns 5'); - t.equal(average(153, 44, 55, 64, 71, 1122, 322774, 2232, 23423, 234, 3631), 32163.909090909092, 'average(153, 44, 55, 64, 71, 1122, 322774, 2232, 23423, 234, 3631) returns 32163.909090909092 '); - t.equal(average(1, 2, 3), 2, 'average(1, 2, 3) returns 2'); - t.equal(average(null), 0, 'average(null) returns 0'); - test('average(1, 2, 3) returns NaN', () => { +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); +}); +test('average(1, 2, 3) returns 2', () => { + expect(average(1, 2, 3)).toBe(2); +}); +test('average(null) returns 0', () => { + expect(average(null)).toBe(0); +}); +test('average(1, 2, 3) returns NaN', () => { expect(isNaN(average(undefined))).toBeTruthy(); }); - test('average(String) returns NaN', () => { +test('average(String) returns NaN', () => { expect(isNaN(average('String'))).toBeTruthy(); }); - test('average({ a: 123}) returns NaN', () => { +test('average({ a: 123}) returns NaN', () => { expect(isNaN(average({ a: 123}))).toBeTruthy(); }); - test('average([undefined, 0, string]) returns NaN', () => { +test('average([undefined, 0, string]) returns NaN', () => { expect(isNaN(average([undefined, 0, 'string']))).toBeTruthy(); }); - 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', () => { +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(); }); - diff --git a/test/averageBy/averageBy.test.js b/test/averageBy/averageBy.test.js index 1176c7e65..044d407df 100644 --- a/test/averageBy/averageBy.test.js +++ b/test/averageBy/averageBy.test.js @@ -1,15 +1,12 @@ const expect = require('expect'); const averageBy = require('./averageBy.js'); - - test('averageBy is a Function', () => { +test('averageBy is a Function', () => { expect(averageBy).toBeInstanceOf(Function); }); - test('Produces the right result with a function', () => { - expect(averageBy([{ n: 4 }, { n: 2 }, { n: 8 }, { n: 6 }], o => o.n), 5).toBe() +test('Produces the right result with a function', () => { + expect(averageBy([{ n: 4 }, { n: 2 }, { n: 8 }, { n: 6 }], o => o.n)).toBe(5); }); - test('Produces the right result with a property name', () => { - expect(averageBy([{ n: 4 }, { n: 2 }, { n: 8 }, { n: 6 }], 'n'), 5).toBe() +test('Produces the right result with a property name', () => { + expect(averageBy([{ n: 4 }, { n: 2 }, { n: 8 }, { n: 6 }], 'n')).toBe(5); }); - - diff --git a/test/bifurcate/bifurcate.test.js b/test/bifurcate/bifurcate.test.js index c7707c710..456d490cb 100644 --- a/test/bifurcate/bifurcate.test.js +++ b/test/bifurcate/bifurcate.test.js @@ -1,10 +1,9 @@ const expect = require('expect'); const bifurcate = require('./bifurcate.js'); - - test('bifurcate is a Function', () => { +test('bifurcate is a Function', () => { expect(bifurcate).toBeInstanceOf(Function); }); - t.deepEqual(bifurcate([ 'beep', 'boop', 'foo', 'bar' ], [ true, true, false, true ]), [ ['beep', 'boop', 'bar'], ['foo'] ], 'Splits the collection into two groups'); - - +test('Splits the collection into two groups', () => { + 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 ca3864909..1b01c76e7 100644 --- a/test/bifurcateBy/bifurcateBy.test.js +++ b/test/bifurcateBy/bifurcateBy.test.js @@ -1,10 +1,9 @@ const expect = require('expect'); const bifurcateBy = require('./bifurcateBy.js'); - - test('bifurcateBy is a Function', () => { +test('bifurcateBy is a Function', () => { expect(bifurcateBy).toBeInstanceOf(Function); }); - t.deepEqual(bifurcateBy([ 'beep', 'boop', 'foo', 'bar' ], x => x[0] === 'b'), [ ['beep', 'boop', 'bar'], ['foo'] ], 'Splits the collection into two groups'); - - +test('Splits the collection into two groups', () => { + expect(bifurcateBy([ 'beep', 'boop', 'foo', 'bar' ], x => x[0] === 'b')).toEqual([ ['beep', 'boop', 'bar'], ['foo'] ]); +}); diff --git a/test/binarySearch/binarySearch.test.js b/test/binarySearch/binarySearch.test.js index 7fcee6d01..3f45f7a98 100644 --- a/test/binarySearch/binarySearch.test.js +++ b/test/binarySearch/binarySearch.test.js @@ -1,12 +1,18 @@ const expect = require('expect'); const binarySearch = require('./binarySearch.js'); - - test('binarySearch is a Function', () => { +test('binarySearch is a Function', () => { expect(binarySearch).toBeInstanceOf(Function); }); - t.equal(binarySearch([1, 4, 6, 7, 12, 13, 15, 18, 19, 20, 22, 24], 6), 2, 'Finds item in array'); - t.equal(binarySearch([1, 4, 6, 7, 12, 13, 15, 18, 19, 20, 22, 24], 21), -1, 'Returns -1 when not found'); - t.equal(binarySearch([], 21), -1, 'Works with empty arrays'); - t.equal(binarySearch([1], 1), 0, "Works for one element arrays"); - +test('Finds item in array', () => { + expect(binarySearch([1, 4, 6, 7, 12, 13, 15, 18, 19, 20, 22, 24], 6)).toBe(2); +}); +test('Returns -1 when not found', () => { + expect(binarySearch([1, 4, 6, 7, 12, 13, 15, 18, 19, 20, 22, 24], 21)).toBe(-1); +}); +test('Works with empty arrays', () => { + expect(binarySearch([], 21)).toBe(-1) +}); +test('Works for one element arrays', () => { + expect(binarySearch([1], 1)).toBe(0); +}); diff --git a/test/bind/bind.test.js b/test/bind/bind.test.js index db56f2d50..423b2b8d9 100644 --- a/test/bind/bind.test.js +++ b/test/bind/bind.test.js @@ -1,17 +1,14 @@ const expect = require('expect'); const bind = require('./bind.js'); - - test('bind is a Function', () => { +test('bind is a Function', () => { expect(bind).toBeInstanceOf(Function); }); - function greet(greeting, punctuation) { - return greeting + ' ' + this.user + punctuation; - } - const freddy = { user: 'fred' }; - const freddyBound = bind(greet, freddy); - test('Binds to an object context', () => { - expect(freddyBound('hi', '!'),'hi fred!').toBe() +function greet(greeting, punctuation) { + return greeting + ' ' + this.user + punctuation; +} +const freddy = { user: 'fred' }; +const freddyBound = bind(greet, freddy); +test('Binds to an object context', () => { + expect(freddyBound('hi', '!')).toBe('hi fred!'); }); - - diff --git a/test/bindAll/bindAll.test.js b/test/bindAll/bindAll.test.js index 0e2ddb66d..1b8a88e8d 100644 --- a/test/bindAll/bindAll.test.js +++ b/test/bindAll/bindAll.test.js @@ -1,17 +1,16 @@ const expect = require('expect'); const bindAll = require('./bindAll.js'); - - test('bindAll is a Function', () => { +test('bindAll is a Function', () => { expect(bindAll).toBeInstanceOf(Function); }); - var view = { - label: 'docs', - 'click': function() { - return 'clicked ' + this.label; - } - }; - bindAll(view, 'click'); - t.equal(view.click(), 'clicked docs', 'Binds to an object context'); - - +var view = { + label: 'docs', + 'click': function() { + return 'clicked ' + this.label; + } +}; +bindAll(view, 'click'); +test('Binds to an object context', () => { + expect(view.click()).toBe('clicked docs') +}); diff --git a/test/bindKey/bindKey.test.js b/test/bindKey/bindKey.test.js index d526a79f8..867576d7b 100644 --- a/test/bindKey/bindKey.test.js +++ b/test/bindKey/bindKey.test.js @@ -1,17 +1,16 @@ const expect = require('expect'); const bindKey = require('./bindKey.js'); - - test('bindKey is a Function', () => { +test('bindKey is a Function', () => { expect(bindKey).toBeInstanceOf(Function); }); - const freddy = { - user: 'fred', - greet: function(greeting, punctuation) { - return greeting + ' ' + this.user + punctuation; - } - }; - const freddyBound = bindKey(freddy, 'greet'); - t.equal(freddyBound('hi', '!'), 'hi fred!', 'Binds function to an object context'); - - +const freddy = { + user: 'fred', + greet: function(greeting, punctuation) { + return greeting + ' ' + this.user + punctuation; + } +}; +const freddyBound = bindKey(freddy, 'greet'); +test('Binds function to an object context', () => { + expect(freddyBound('hi', '!')).toBe('hi fred!') +}); diff --git a/test/binomialCoefficient/binomialCoefficient.test.js b/test/binomialCoefficient/binomialCoefficient.test.js index 74b9f5b2e..e4ca4f3ce 100644 --- a/test/binomialCoefficient/binomialCoefficient.test.js +++ b/test/binomialCoefficient/binomialCoefficient.test.js @@ -1,18 +1,21 @@ const expect = require('expect'); const binomialCoefficient = require('./binomialCoefficient.js'); - - test('binomialCoefficient is a Function', () => { +test('binomialCoefficient is a Function', () => { expect(binomialCoefficient).toBeInstanceOf(Function); }); - t.equal(binomialCoefficient(8, 2), 28, 'Returns the appropriate value'); - t.equal(binomialCoefficient(0, 0), 1, 'Returns the appropriate value'); - t.equal(binomialCoefficient(5, 3), 10, 'Returns the appropriate value'); - test('Returns NaN', () => { +test('Returns the appropriate value', () => { + expect(binomialCoefficient(8, 2)).toBe(28); +}); +test('Returns the appropriate value', () => { + expect(binomialCoefficient(0, 0)).toBe(1); +}); +test('Returns the appropriate value', () => { + expect(binomialCoefficient(5, 3)).toBe(10); +}); +test('Returns NaN', () => { expect(Number.isNaN(binomialCoefficient(NaN, 3))).toBeTruthy(); }); - test('Returns NaN', () => { +test('Returns NaN', () => { expect(Number.isNaN(binomialCoefficient(5, NaN))).toBeTruthy(); }); - - diff --git a/test/bottomVisible/bottomVisible.test.js b/test/bottomVisible/bottomVisible.test.js index f81b9b59a..6769b3cbd 100644 --- a/test/bottomVisible/bottomVisible.test.js +++ b/test/bottomVisible/bottomVisible.test.js @@ -1,10 +1,6 @@ const expect = require('expect'); const bottomVisible = require('./bottomVisible.js'); - - test('bottomVisible is a Function', () => { +test('bottomVisible is a Function', () => { expect(bottomVisible).toBeInstanceOf(Function); }); - t.pass('Tested on 09/02/2018 by @chalarangelo'); - - diff --git a/test/btoa/btoa.test.js b/test/btoa/btoa.test.js index d0d97bb75..36b740293 100644 --- a/test/btoa/btoa.test.js +++ b/test/btoa/btoa.test.js @@ -1,12 +1,9 @@ const expect = require('expect'); const btoa = require('./btoa.js'); - - test('btoa is a Function', () => { +test('btoa is a Function', () => { expect(btoa).toBeInstanceOf(Function); }); - test('btoa("foobar") equals "Zm9vYmFy"', () => { - expect(btoa('foobar'), 'Zm9vYmFy').toBe() +test('btoa("foobar") equals "Zm9vYmFy"', () => { + expect(btoa('foobar')).toBe('Zm9vYmFy'); }); - - diff --git a/test/byteSize/byteSize.test.js b/test/byteSize/byteSize.test.js index 2e6bfee63..ad6371480 100644 --- a/test/byteSize/byteSize.test.js +++ b/test/byteSize/byteSize.test.js @@ -8,11 +8,15 @@ const Blob = class{ }; const byteSize = str => new Blob([str]).size; - test('byteSize is a Function', () => { +test('byteSize is a Function', () => { expect(byteSize).toBeInstanceOf(Function); }); - t.equal(byteSize('a'), 1, 'Works for a single letter'); - t.equal(byteSize('Hello World'), 11, 'Works for a common string'); - t.equal(byteSize('😀'), 4, 'Works for emoji'); - - +test('Works for a single letter', () => { + expect(byteSize('a')).toBe(1); +}); +test('Works for a common string', () => { + expect(byteSize('Hello World')).toBe(11); +}); +test('Works for emoji', () => { + expect(byteSize('😀')).toBe(4); +}); diff --git a/test/castArray/castArray.test.js b/test/castArray/castArray.test.js index 5b849197c..f3883879a 100644 --- a/test/castArray/castArray.test.js +++ b/test/castArray/castArray.test.js @@ -5,10 +5,20 @@ const castArray = require('./castArray.js'); test('castArray is a Function', () => { expect(castArray).toBeInstanceOf(Function); }); - t.deepEqual(castArray(1), [1], 'Works for single values'); - t.deepEqual(castArray([1]), [1], 'Works for arrays with one value'); - t.deepEqual(castArray([1,2,3]), [1,2,3], 'Works for arrays with multiple value'); - t.deepEqual(castArray('test'), ['test'], 'Works for strings'); - t.deepEqual(castArray({}), [{}], 'Works for objects'); + test('Works for single values', () => { + expect(castArray(1), [1]).toEqual() +}); + test('Works for arrays with one value', () => { + expect(castArray([1]), [1]).toEqual() +}); + test('Works for arrays with multiple value', () => { + expect(castArray([1,2,3]), [1,2,3]).toEqual() +}); + test('Works for strings', () => { + expect(castArray('test'), ['test']).toEqual() +}); + test('Works for objects', () => { + expect(castArray({}), [{}]).toEqual() +}); diff --git a/test/chainAsync/chainAsync.test.js b/test/chainAsync/chainAsync.test.js index 43cd39c4f..8e90219ef 100644 --- a/test/chainAsync/chainAsync.test.js +++ b/test/chainAsync/chainAsync.test.js @@ -15,7 +15,7 @@ const chainAsync = require('./chainAsync.js'); })(); }, next => { - t.pass("Calls all functions in an array"); + } ]); diff --git a/test/chunk/chunk.test.js b/test/chunk/chunk.test.js index 8db6625c8..f257adac8 100644 --- a/test/chunk/chunk.test.js +++ b/test/chunk/chunk.test.js @@ -6,10 +6,18 @@ const chunk = require('./chunk.js'); expect(chunk).toBeInstanceOf(Function); }); t.deepEqual(chunk([1, 2, 3, 4, 5], 2), [[1,2],[3,4],[5]], "chunk([1, 2, 3, 4, 5], 2) returns [[1,2],[3,4],[5]] "); - t.deepEqual(chunk([]), [], 'chunk([]) returns []'); - t.deepEqual(chunk(123), [], 'chunk(123) returns []'); - t.deepEqual(chunk({ a: 123}), [], 'chunk({ a: 123}) returns []'); - t.deepEqual(chunk('string', 2), [ 'st', 'ri', 'ng' ], 'chunk(string, 2) returns [ st, ri, ng ]'); + test('chunk([]) returns []', () => { + expect(chunk([]), []).toEqual() +}); + test('chunk(123) returns []', () => { + expect(chunk(123), []).toEqual() +}); + test('chunk({ a: 123}) returns []', () => { + expect(chunk({ a: 123}), []).toEqual() +}); + test('chunk(string, 2) returns [ st, ri, ng ]', () => { + expect(chunk('string', 2), [ 'st', 'ri', 'ng' ]).toEqual() +}); t.throws(() => chunk(), 'chunk() throws an error'); t.throws(() => chunk(undefined), 'chunk(undefined) throws an error'); t.throws(() => chunk(null), 'chunk(null) throws an error'); diff --git a/test/collatz/collatz.test.js b/test/collatz/collatz.test.js index fa2b6ed25..9598acaa9 100644 --- a/test/collatz/collatz.test.js +++ b/test/collatz/collatz.test.js @@ -5,13 +5,17 @@ const collatz = require('./collatz.js'); test('collatz is a Function', () => { expect(collatz).toBeInstanceOf(Function); }); - t.equal(collatz(8), 4, 'When n is even, divide by 2'); - t.equal(collatz(9), 28, 'When n is odd, times by 3 and add 1'); + test('When n is even, divide by 2', () => { + expect(collatz(8), 4).toBe() +}); + test('When n is odd, times by 3 and add 1', () => { + expect(collatz(9), 28).toBe() +}); let n = 9; while(true){ if (n === 1){ - t.pass('Eventually reaches 1'); + break; } n = collatz(n); diff --git a/test/collectInto/collectInto.test.js b/test/collectInto/collectInto.test.js index 30e358c50..e2a073af8 100644 --- a/test/collectInto/collectInto.test.js +++ b/test/collectInto/collectInto.test.js @@ -9,6 +9,8 @@ const collectInto = require('./collectInto.js'); let p1 = Promise.resolve(1); let p2 = Promise.resolve(2); let p3 = new Promise(resolve => setTimeout(resolve, 2000, 3)); - Pall(p1, p2, p3).then(function(val){ t.deepEqual(val, [1,2,3], 'Works with multiple promises');}, function(reason){ + Pall(p1, p2, p3).then(function(val){ test('Works with multiple promises', () => { + expect(val, [1,2,3]).toEqual() +});}, function(reason){ diff --git a/test/colorize/colorize.test.js b/test/colorize/colorize.test.js index b708096d8..10950ab7f 100644 --- a/test/colorize/colorize.test.js +++ b/test/colorize/colorize.test.js @@ -5,6 +5,6 @@ const colorize = require('./colorize.js'); test('colorize is a Function', () => { expect(colorize).toBeInstanceOf(Function); }); - t.pass('Tested on 09/02/2018 by @chalarangelo'); + diff --git a/test/converge/converge.test.js b/test/converge/converge.test.js index 34c71906d..bd8f4e4bd 100644 --- a/test/converge/converge.test.js +++ b/test/converge/converge.test.js @@ -9,11 +9,15 @@ const converge = require('./converge.js'); arr => arr.reduce((a, v) => a + v, 0), arr => arr.length, ]); - t.equal(average([1, 2, 3, 4, 5, 6, 7]), 4, 'Produces the average of the array'); + test('Produces the average of the array', () => { + expect(average([1, 2, 3, 4, 5, 6, 7]), 4).toBe() +}); const strangeConcat = converge((a, b) => a + b, [ x => x.toUpperCase(), x => x.toLowerCase()] ); - t.equal(strangeConcat('Yodel'), "YODELyodel", 'Produces the strange concatenation'); + test('Produces the strange concatenation', () => { + expect(strangeConcat('Yodel'), "YODELyodel").toBe() +}); diff --git a/test/copyToClipboard/copyToClipboard.test.js b/test/copyToClipboard/copyToClipboard.test.js index 9344d6296..66c5cb5bf 100644 --- a/test/copyToClipboard/copyToClipboard.test.js +++ b/test/copyToClipboard/copyToClipboard.test.js @@ -5,6 +5,6 @@ const copyToClipboard = require('./copyToClipboard.js'); test('copyToClipboard is a Function', () => { expect(copyToClipboard).toBeInstanceOf(Function); }); - t.pass('Tested on 09/02/2018 by @chalarangelo'); + diff --git a/test/countBy/countBy.test.js b/test/countBy/countBy.test.js index c73ffa3ac..d013534ee 100644 --- a/test/countBy/countBy.test.js +++ b/test/countBy/countBy.test.js @@ -5,7 +5,11 @@ const countBy = require('./countBy.js'); test('countBy is a Function', () => { expect(countBy).toBeInstanceOf(Function); }); - t.deepEqual(countBy([6.1, 4.2, 6.3], Math.floor), {4: 1, 6: 2}, 'Works for functions'); - t.deepEqual(countBy(['one', 'two', 'three'], 'length'), {3: 2, 5: 1}, 'Works for property names'); + test('Works for functions', () => { + expect(countBy([6.1, 4.2, 6.3], Math.floor), {4: 1, 6: 2}).toEqual() +}); + test('Works for property names', () => { + expect(countBy(['one', 'two', 'three'], 'length'), {3: 2, 5: 1}).toEqual() +}); diff --git a/test/createElement/createElement.test.js b/test/createElement/createElement.test.js index 2ad5a2124..d046f62e7 100644 --- a/test/createElement/createElement.test.js +++ b/test/createElement/createElement.test.js @@ -5,6 +5,6 @@ const createElement = require('./createElement.js'); test('createElement is a Function', () => { expect(createElement).toBeInstanceOf(Function); }); - t.pass('Tested by @chalarangelo on 16/02/2018'); + diff --git a/test/createEventHub/createEventHub.test.js b/test/createEventHub/createEventHub.test.js index 179f2c7c1..4a847285e 100644 --- a/test/createEventHub/createEventHub.test.js +++ b/test/createEventHub/createEventHub.test.js @@ -5,6 +5,6 @@ const createEventHub = require('./createEventHub.js'); test('createEventHub is a Function', () => { expect(createEventHub).toBeInstanceOf(Function); }); - t.pass('Tested by @chalarangelo on 16/02/2018'); + diff --git a/test/currentURL/currentURL.test.js b/test/currentURL/currentURL.test.js index 8344c7163..61c3a2fce 100644 --- a/test/currentURL/currentURL.test.js +++ b/test/currentURL/currentURL.test.js @@ -5,6 +5,6 @@ const currentURL = require('./currentURL.js'); test('currentURL is a Function', () => { expect(currentURL).toBeInstanceOf(Function); }); - t.pass('Tested by @chalarangelo on 16/02/2018'); + diff --git a/test/debounce/debounce.test.js b/test/debounce/debounce.test.js index 81e49d2bd..a4f4db6d2 100644 --- a/test/debounce/debounce.test.js +++ b/test/debounce/debounce.test.js @@ -5,6 +5,6 @@ const debounce = require('./debounce.js'); test('debounce is a Function', () => { expect(debounce).toBeInstanceOf(Function); }); - debounce(() => {t.pass('Works as expected');}, 250); + debounce(() => { diff --git a/test/decapitalize/decapitalize.test.js b/test/decapitalize/decapitalize.test.js index 5adbd21a1..866c49271 100644 --- a/test/decapitalize/decapitalize.test.js +++ b/test/decapitalize/decapitalize.test.js @@ -5,7 +5,11 @@ const decapitalize = require('./decapitalize.js'); test('decapitalize is a Function', () => { expect(decapitalize).toBeInstanceOf(Function); }); - t.equal(decapitalize('FooBar'), 'fooBar', 'Works with default parameter'); - t.equal(decapitalize('FooBar', true), 'fOOBAR', 'Works with second parameter set to true'); + test('Works with default parameter', () => { + expect(decapitalize('FooBar'), 'fooBar').toBe() +}); + test('Works with second parameter set to true', () => { + expect(decapitalize('FooBar', true), 'fOOBAR').toBe() +}); diff --git a/test/defaults/defaults.test.js b/test/defaults/defaults.test.js index 41e3224aa..c713eea1b 100644 --- a/test/defaults/defaults.test.js +++ b/test/defaults/defaults.test.js @@ -5,6 +5,8 @@ const defaults = require('./defaults.js'); test('defaults is a Function', () => { expect(defaults).toBeInstanceOf(Function); }); - t.deepEqual(defaults({ a: 1 }, { b: 2 }, { b: 6 }, { a: 3 }), { a: 1, b: 2 }, 'Assigns default values for undefined properties'); + test('Assigns default values for undefined properties', () => { + expect(defaults({ a: 1 }, { b: 2 }, { b: 6 }, { a: 3 }), { a: 1, b: 2 }).toEqual() +}); diff --git a/test/defer/defer.test.js b/test/defer/defer.test.js index 1e05fdb09..46ff55ac6 100644 --- a/test/defer/defer.test.js +++ b/test/defer/defer.test.js @@ -5,6 +5,6 @@ const defer = require('./defer.js'); test('defer is a Function', () => { expect(defer).toBeInstanceOf(Function); }); - t.pass('Tested by @chalarangelo on 16/02/2018'); + diff --git a/test/detectDeviceType/detectDeviceType.test.js b/test/detectDeviceType/detectDeviceType.test.js index 55f89c2e1..124315e80 100644 --- a/test/detectDeviceType/detectDeviceType.test.js +++ b/test/detectDeviceType/detectDeviceType.test.js @@ -5,6 +5,6 @@ const detectDeviceType = require('./detectDeviceType.js'); test('detectDeviceType is a Function', () => { expect(detectDeviceType).toBeInstanceOf(Function); }); - t.pass('Tested on 09/02/2018 by @chalarangelo'); + diff --git a/test/differenceBy/differenceBy.test.js b/test/differenceBy/differenceBy.test.js index dc25227a6..44265c43f 100644 --- a/test/differenceBy/differenceBy.test.js +++ b/test/differenceBy/differenceBy.test.js @@ -5,7 +5,11 @@ const differenceBy = require('./differenceBy.js'); test('differenceBy is a Function', () => { expect(differenceBy).toBeInstanceOf(Function); }); - t.deepEqual(differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor), [1.2], 'Works using a native function and numbers'); - t.deepEqual(differenceBy([{ x: 2 }, { x: 1 }], [{ x: 1 }], v => v.x), [ { x: 2 } ], 'Works with arrow function and objects'); + test('Works using a native function and numbers', () => { + expect(differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor), [1.2]).toEqual() +}); + test('Works with arrow function and objects', () => { + expect(differenceBy([{ x: 2 }, { x: 1 }], [{ x: 1 }], v => v.x), [ { x: 2 } ]).toEqual() +}); diff --git a/test/drop/drop.test.js b/test/drop/drop.test.js index 679f96926..5c864463e 100644 --- a/test/drop/drop.test.js +++ b/test/drop/drop.test.js @@ -5,8 +5,14 @@ const drop = require('./drop.js'); test('drop is a Function', () => { expect(drop).toBeInstanceOf(Function); }); - t.deepEqual(drop([1, 2, 3]), [2,3], 'Works without the last argument'); - t.deepEqual(drop([1, 2, 3], 2), [3], 'Removes appropriate element count as specified'); - t.deepEqual(drop([1, 2, 3], 42), [], 'Empties array given a count greater than length'); + test('Works without the last argument', () => { + expect(drop([1, 2, 3]), [2,3]).toEqual() +}); + test('Removes appropriate element count as specified', () => { + expect(drop([1, 2, 3], 2), [3]).toEqual() +}); + test('Empties array given a count greater than length', () => { + expect(drop([1, 2, 3], 42), []).toEqual() +}); diff --git a/test/dropRightWhile/dropRightWhile.test.js b/test/dropRightWhile/dropRightWhile.test.js index b59d5d0e3..228dea2e3 100644 --- a/test/dropRightWhile/dropRightWhile.test.js +++ b/test/dropRightWhile/dropRightWhile.test.js @@ -5,6 +5,8 @@ const dropRightWhile = require('./dropRightWhile.js'); test('dropRightWhile is a Function', () => { expect(dropRightWhile).toBeInstanceOf(Function); }); - t.deepEqual(dropRightWhile([1, 2, 3, 4], n => n < 3), [1, 2], 'Removes elements from the end of an array until the passed function returns true.'); + test('Removes elements from the end of an array until the passed function returns true.', () => { + expect(dropRightWhile([1, 2, 3, 4], n => n < 3), [1, 2]).toEqual() +}); diff --git a/test/dropWhile/dropWhile.test.js b/test/dropWhile/dropWhile.test.js index 380a55d10..4bff04c43 100644 --- a/test/dropWhile/dropWhile.test.js +++ b/test/dropWhile/dropWhile.test.js @@ -5,6 +5,8 @@ const dropWhile = require('./dropWhile.js'); test('dropWhile is a Function', () => { expect(dropWhile).toBeInstanceOf(Function); }); - t.deepEqual(dropWhile([1, 2, 3, 4], n => n >= 3), [3,4], 'Removes elements in an array until the passed function returns true.'); + test('Removes elements in an array until the passed function returns true.', () => { + expect(dropWhile([1, 2, 3, 4], n => n >= 3), [3,4]).toEqual() +}); diff --git a/test/elementIsVisibleInViewport/elementIsVisibleInViewport.test.js b/test/elementIsVisibleInViewport/elementIsVisibleInViewport.test.js index 0970f53cf..d7bc61cd5 100644 --- a/test/elementIsVisibleInViewport/elementIsVisibleInViewport.test.js +++ b/test/elementIsVisibleInViewport/elementIsVisibleInViewport.test.js @@ -5,6 +5,6 @@ const elementIsVisibleInViewport = require('./elementIsVisibleInViewport.js'); test('elementIsVisibleInViewport is a Function', () => { expect(elementIsVisibleInViewport).toBeInstanceOf(Function); }); - t.pass('Tested on 09/02/2018 by @chalarangelo'); + diff --git a/test/findLast/findLast.test.js b/test/findLast/findLast.test.js index 2435d0b09..3949b7eef 100644 --- a/test/findLast/findLast.test.js +++ b/test/findLast/findLast.test.js @@ -5,6 +5,8 @@ const findLast = require('./findLast.js'); test('findLast is a Function', () => { expect(findLast).toBeInstanceOf(Function); }); - t.equal(findLast([1, 2, 3, 4], n => n % 2 === 1), 3, 'Finds last element for which the given function returns true'); + test('Finds last element for which the given function returns true', () => { + expect(findLast([1, 2, 3, 4], n => n % 2 === 1), 3).toBe() +}); diff --git a/test/findLastIndex/findLastIndex.test.js b/test/findLastIndex/findLastIndex.test.js index 5fc425166..190e2cde8 100644 --- a/test/findLastIndex/findLastIndex.test.js +++ b/test/findLastIndex/findLastIndex.test.js @@ -5,6 +5,8 @@ const findLastIndex = require('./findLastIndex.js'); test('findLastIndex is a Function', () => { expect(findLastIndex).toBeInstanceOf(Function); }); - t.equal(findLastIndex([1, 2, 3, 4], n => n % 2 === 1), 2, 'Finds last index for which the given function returns true'); + test('Finds last index for which the given function returns true', () => { + expect(findLastIndex([1, 2, 3, 4], n => n % 2 === 1), 2).toBe() +}); diff --git a/test/flattenObject/flattenObject.test.js b/test/flattenObject/flattenObject.test.js index 2d3b9a758..eb353fa5f 100644 --- a/test/flattenObject/flattenObject.test.js +++ b/test/flattenObject/flattenObject.test.js @@ -5,7 +5,11 @@ const flattenObject = require('./flattenObject.js'); test('flattenObject is a Function', () => { expect(flattenObject).toBeInstanceOf(Function); }); - t.deepEqual(flattenObject({ a: { b: { c: 1 } }, d: 1 }), { 'a.b.c': 1, d: 1 }, 'Flattens an object with the paths for keys'); - t.deepEqual(flattenObject([0,1,[2,[1]],1]), { 0: 0, 1: 1, 3: 1, '2.0': 2, '2.1.0': 1 }, 'Works with arrays'); + test('Flattens an object with the paths for keys', () => { + expect(flattenObject({ a: { b: { c: 1 } }, d: 1 }), { 'a.b.c': 1, d: 1 }).toEqual() +}); + test('Works with arrays', () => { + expect(flattenObject([0,1,[2,[1]],1]), { 0: 0, 1: 1, 3: 1, '2.0': 2, '2.1.0': 1 }).toEqual() +}); diff --git a/test/flip/flip.test.js b/test/flip/flip.test.js index f5b120b8c..912e91c22 100644 --- a/test/flip/flip.test.js +++ b/test/flip/flip.test.js @@ -9,6 +9,8 @@ const flip = require('./flip.js'); let b = {}; const mergeFrom = flip(Object.assign); let mergePerson = mergeFrom.bind(null, a); - t.deepEqual(mergePerson(b), a, 'Flips argument order'); + test('Flips argument order', () => { + expect(mergePerson(b), a).toEqual() +}); diff --git a/test/forEachRight/forEachRight.test.js b/test/forEachRight/forEachRight.test.js index 69b66df3f..bd42e32f3 100644 --- a/test/forEachRight/forEachRight.test.js +++ b/test/forEachRight/forEachRight.test.js @@ -7,6 +7,8 @@ const forEachRight = require('./forEachRight.js'); }); let output = ''; forEachRight([1, 2, 3, 4], val => output+=val); - t.equal(output, '4321', 'Iterates over the array in reverse'); + test('Iterates over the array in reverse', () => { + expect(output, '4321').toBe() +}); diff --git a/test/forOwn/forOwn.test.js b/test/forOwn/forOwn.test.js index 4b6931628..1b41dfb38 100644 --- a/test/forOwn/forOwn.test.js +++ b/test/forOwn/forOwn.test.js @@ -7,6 +7,8 @@ const forOwn = require('./forOwn.js'); }); let output = []; forOwn({ foo: 'bar', a: 1 }, v => output.push(v)); - t.deepEqual(output, ['bar', 1], 'Iterates over an element\'s key-value pairs'); + test('Iterates over an element\'s key-value pairs', () => { + expect(output, ['bar', 1]).toEqual() +}); diff --git a/test/forOwnRight/forOwnRight.test.js b/test/forOwnRight/forOwnRight.test.js index 9e18b97f7..01ce32b65 100644 --- a/test/forOwnRight/forOwnRight.test.js +++ b/test/forOwnRight/forOwnRight.test.js @@ -7,6 +7,8 @@ const forOwnRight = require('./forOwnRight.js'); }); let output = []; forOwnRight({ foo: 'bar', a: 1 }, v => output.push(v)); - t.deepEqual(output, [1, 'bar'], 'Iterates over an element\'s key-value pairs in reverse'); + test('Iterates over an element\'s key-value pairs in reverse', () => { + expect(output, [1, 'bar']).toEqual() +}); diff --git a/test/functionName/functionName.test.js b/test/functionName/functionName.test.js index e23478794..750c856b1 100644 --- a/test/functionName/functionName.test.js +++ b/test/functionName/functionName.test.js @@ -8,12 +8,18 @@ const functionName = fn => (console.debug(fn.name), fn); expect(functionName).toBeInstanceOf(Function); }); functionName(Math.max); - t.equal(output, 'max', 'Works for native functions'); + test('Works for native functions', () => { + expect(output, 'max').toBe() +}); function fun(x) {return x;} functionName(fun); - t.equal(output, 'fun', 'Works for functions'); + test('Works for functions', () => { + expect(output, 'fun').toBe() +}); const fn = x => x; functionName(fn); - t.equal(output, 'fn', 'Works for arrow functions'); + test('Works for arrow functions', () => { + expect(output, 'fn').toBe() +}); diff --git a/test/functions/functions.test.js b/test/functions/functions.test.js index eb182cbb0..cade171cb 100644 --- a/test/functions/functions.test.js +++ b/test/functions/functions.test.js @@ -10,7 +10,11 @@ const functions = require('./functions.js'); this.b = () => 2; } Foo.prototype.c = () => 3; - t.deepEqual(functions(new Foo()), ['a', 'b'], 'Returns own methods'); - t.deepEqual(functions(new Foo(), true), ['a', 'b', 'c'], 'Returns own and inherited methods'); + test('Returns own methods', () => { + expect(functions(new Foo()), ['a', 'b']).toEqual() +}); + test('Returns own and inherited methods', () => { + expect(functions(new Foo(), true), ['a', 'b', 'c']).toEqual() +}); diff --git a/test/getScrollPosition/getScrollPosition.test.js b/test/getScrollPosition/getScrollPosition.test.js index 24746b482..7e9b12367 100644 --- a/test/getScrollPosition/getScrollPosition.test.js +++ b/test/getScrollPosition/getScrollPosition.test.js @@ -5,6 +5,6 @@ const getScrollPosition = require('./getScrollPosition.js'); test('getScrollPosition is a Function', () => { expect(getScrollPosition).toBeInstanceOf(Function); }); - t.pass('Tested by @chalarangelo on 16/02/2018'); + diff --git a/test/getStyle/getStyle.test.js b/test/getStyle/getStyle.test.js index 0c50ec687..46fa01505 100644 --- a/test/getStyle/getStyle.test.js +++ b/test/getStyle/getStyle.test.js @@ -5,6 +5,6 @@ const getStyle = require('./getStyle.js'); test('getStyle is a Function', () => { expect(getStyle).toBeInstanceOf(Function); }); - t.pass('Tested by @chalarangelo on 16/02/2018'); + diff --git a/test/hasFlags/hasFlags.test.js b/test/hasFlags/hasFlags.test.js index a8eeb0dc3..0278eed8e 100644 --- a/test/hasFlags/hasFlags.test.js +++ b/test/hasFlags/hasFlags.test.js @@ -5,6 +5,6 @@ const hasFlags = require('./hasFlags.js'); test('hasFlags is a Function', () => { expect(hasFlags).toBeInstanceOf(Function); }); - t.pass('Tested by @chalarangelo on 16/02/2018'); + diff --git a/test/hashBrowser/hashBrowser.test.js b/test/hashBrowser/hashBrowser.test.js index 71043e545..f46f2f572 100644 --- a/test/hashBrowser/hashBrowser.test.js +++ b/test/hashBrowser/hashBrowser.test.js @@ -5,6 +5,6 @@ const hashBrowser = require('./hashBrowser.js'); test('hashBrowser is a Function', () => { expect(hashBrowser).toBeInstanceOf(Function); }); - t.pass('Tested by @chalarangelo on 16/02/2018'); + diff --git a/test/head/head.test.js b/test/head/head.test.js index 3a672d76b..fd29c145c 100644 --- a/test/head/head.test.js +++ b/test/head/head.test.js @@ -9,8 +9,12 @@ const head = require('./head.js'); expect(head({ a: 1234}) === undefined).toBeTruthy(); }); t.equal(head([1, 2, 3]), 1, "head([1, 2, 3]) returns 1"); - t.equal(head({ 0: false}), false, 'head({ 0: false}) returns false'); - t.equal(head('String'), 'S', 'head(String) returns S'); + test('head({ 0: false}) returns false', () => { + expect(head({ 0: false}), false).toBe() +}); + test('head(String) returns S', () => { + expect(head('String'), 'S').toBe() +}); t.throws(() => head(null), 'head(null) throws an Error'); t.throws(() => head(undefined), 'head(undefined) throws an Error'); t.throws(() => head(), 'head() throws an Error'); diff --git a/test/hide/hide.test.js b/test/hide/hide.test.js index e5cf19bdd..ae3a4e4a0 100644 --- a/test/hide/hide.test.js +++ b/test/hide/hide.test.js @@ -5,6 +5,6 @@ const hide = require('./hide.js'); test('hide is a Function', () => { expect(hide).toBeInstanceOf(Function); }); - t.pass('Tested by @chalarangelo on 16/02/2018'); + diff --git a/test/httpPost/httpPost.test.js b/test/httpPost/httpPost.test.js index 876e5a69d..62e65a49c 100644 --- a/test/httpPost/httpPost.test.js +++ b/test/httpPost/httpPost.test.js @@ -17,7 +17,9 @@ const httpPost = (url, data, callback, err = console.error) => { userId: 1 }; httpPost('https: - t.deepEqual(JSON.parse(response).id, 101, 'Sends a POST request'); + test('Sends a POST request', () => { + expect(JSON.parse(response).id, 101).toEqual() +}); diff --git a/test/httpsRedirect/httpsRedirect.test.js b/test/httpsRedirect/httpsRedirect.test.js index 338c0f925..6727278bc 100644 --- a/test/httpsRedirect/httpsRedirect.test.js +++ b/test/httpsRedirect/httpsRedirect.test.js @@ -5,6 +5,6 @@ const httpsRedirect = require('./httpsRedirect.js'); test('httpsRedirect is a Function', () => { expect(httpsRedirect).toBeInstanceOf(Function); }); - t.pass('Tested on 09/02/2018 by @chalarangelo'); + diff --git a/test/intersectionBy/intersectionBy.test.js b/test/intersectionBy/intersectionBy.test.js index f6efdbfae..2c5207f23 100644 --- a/test/intersectionBy/intersectionBy.test.js +++ b/test/intersectionBy/intersectionBy.test.js @@ -5,6 +5,8 @@ const intersectionBy = require('./intersectionBy.js'); test('intersectionBy is a Function', () => { expect(intersectionBy).toBeInstanceOf(Function); }); - t.deepEqual(intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor), [2.1], 'Returns a list of elements that exist in both arrays, after applying the provided function to each array element of both'); + test('Returns a list of elements that exist in both arrays, after applying the provided function to each array element of both', () => { + expect(intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor), [2.1]).toEqual() +}); diff --git a/test/intersectionWith/intersectionWith.test.js b/test/intersectionWith/intersectionWith.test.js index 28f704a38..09ed1a88e 100644 --- a/test/intersectionWith/intersectionWith.test.js +++ b/test/intersectionWith/intersectionWith.test.js @@ -5,6 +5,8 @@ const intersectionWith = require('./intersectionWith.js'); test('intersectionWith is a Function', () => { expect(intersectionWith).toBeInstanceOf(Function); }); - t.deepEqual(intersectionWith([1, 1.2, 1.5, 3, 0], [1.9, 3, 0, 3.9], (a, b) => Math.round(a) === Math.round(b)), [1.5, 3, 0], 'Returns a list of elements that exist in both arrays, using a provided comparator 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)), [1.5, 3, 0]).toEqual() +}); diff --git a/test/isArrayLike/isArrayLike.test.js b/test/isArrayLike/isArrayLike.test.js index 253efd87d..a274a66db 100644 --- a/test/isArrayLike/isArrayLike.test.js +++ b/test/isArrayLike/isArrayLike.test.js @@ -5,8 +5,14 @@ const isArrayLike = require('./isArrayLike.js'); test('isArrayLike is a Function', () => { expect(isArrayLike).toBeInstanceOf(Function); }); - t.equal(isArrayLike('abc'), true, 'Returns true for a string'); - t.equal(isArrayLike([1,2,3]), true, 'Returns true for an array'); - t.equal(isArrayLike(null), false, 'Returns false for null'); + test('Returns true for a string', () => { + expect(isArrayLike('abc'), true).toBe() +}); + test('Returns true for an array', () => { + expect(isArrayLike([1,2,3]), true).toBe() +}); + test('Returns false for null', () => { + expect(isArrayLike(null), false).toBe() +}); diff --git a/test/isDivisible/isDivisible.test.js b/test/isDivisible/isDivisible.test.js index 741dd3f1d..adb867938 100644 --- a/test/isDivisible/isDivisible.test.js +++ b/test/isDivisible/isDivisible.test.js @@ -5,5 +5,7 @@ const isDivisible = require('./isDivisible.js'); test('isDivisible is a Function', () => { expect(isDivisible).toBeInstanceOf(Function); }); - t.equal(isDivisible(6, 3), true, 'The number 6 is divisible by 3'); + test('The number 6 is divisible by 3', () => { + expect(isDivisible(6, 3), true).toBe() +}); diff --git a/test/isEmpty/isEmpty.test.js b/test/isEmpty/isEmpty.test.js index 21e96f65d..0144a4096 100644 --- a/test/isEmpty/isEmpty.test.js +++ b/test/isEmpty/isEmpty.test.js @@ -5,15 +5,35 @@ const isEmpty = require('./isEmpty.js'); test('isEmpty is a Function', () => { expect(isEmpty).toBeInstanceOf(Function); }); - t.equal(isEmpty(new Map()), true, 'Returns true for empty Map'); - t.equal(isEmpty(new Set()), true, 'Returns true for empty Set'); - t.equal(isEmpty([]), true, 'Returns true for empty array'); - t.equal(isEmpty({}), true, 'Returns true for empty object'); - t.equal(isEmpty(''), true, 'Returns true for empty string'); - t.equal(isEmpty([1, 2]), false, 'Returns false for non-empty array'); - t.equal(isEmpty({ a: 1, b: 2 }), false, 'Returns false for non-empty object'); - t.equal(isEmpty('text'), false, 'Returns false for non-empty string'); - t.equal(isEmpty(123), true, 'Returns true - type is not considered a collection'); - t.equal(isEmpty(true), true, 'Returns true - type is not considered a collection'); + test('Returns true for empty Map', () => { + expect(isEmpty(new Map()), true).toBe() +}); + test('Returns true for empty Set', () => { + expect(isEmpty(new Set()), true).toBe() +}); + test('Returns true for empty array', () => { + expect(isEmpty([]), true).toBe() +}); + test('Returns true for empty object', () => { + expect(isEmpty({}), true).toBe() +}); + test('Returns true for empty string', () => { + expect(isEmpty(''), true).toBe() +}); + test('Returns false for non-empty array', () => { + expect(isEmpty([1, 2]), false).toBe() +}); + test('Returns false for non-empty object', () => { + expect(isEmpty({ a: 1, b: 2 }), false).toBe() +}); + test('Returns false for non-empty string', () => { + expect(isEmpty('text'), false).toBe() +}); + test('Returns true - type is not considered a collection', () => { + expect(isEmpty(123), true).toBe() +}); + test('Returns true - type is not considered a collection', () => { + expect(isEmpty(true), true).toBe() +}); diff --git a/test/isEven/isEven.test.js b/test/isEven/isEven.test.js index 5065b80c8..3a1136da1 100644 --- a/test/isEven/isEven.test.js +++ b/test/isEven/isEven.test.js @@ -5,7 +5,9 @@ const isEven = require('./isEven.js'); test('isEven is a Function', () => { expect(isEven).toBeInstanceOf(Function); }); - t.equal(isEven(4), true, '4 is even number'); + test('4 is even number', () => { + expect(isEven(4), true).toBe() +}); test('5 is not an even number', () => { expect(isEven(5), false).toBeFalsy(); }); diff --git a/test/isNil/isNil.test.js b/test/isNil/isNil.test.js index 3ee0892a0..e193e8075 100644 --- a/test/isNil/isNil.test.js +++ b/test/isNil/isNil.test.js @@ -5,8 +5,14 @@ const isNil = require('./isNil.js'); test('isNil is a Function', () => { expect(isNil).toBeInstanceOf(Function); }); - t.equal(isNil(null), true, 'Returns true for null'); - t.equal(isNil(undefined), true, 'Returns true for undefined'); - t.equal(isNil(''), false, 'Returns false for an empty string'); + test('Returns true for null', () => { + expect(isNil(null), true).toBe() +}); + test('Returns true for undefined', () => { + expect(isNil(undefined), true).toBe() +}); + test('Returns false for an empty string', () => { + expect(isNil(''), false).toBe() +}); diff --git a/test/isObjectLike/isObjectLike.test.js b/test/isObjectLike/isObjectLike.test.js index 1bf9fe014..ad1f9c263 100644 --- a/test/isObjectLike/isObjectLike.test.js +++ b/test/isObjectLike/isObjectLike.test.js @@ -5,9 +5,17 @@ const isObjectLike = require('./isObjectLike.js'); test('isObjectLike is a Function', () => { expect(isObjectLike).toBeInstanceOf(Function); }); - t.equal(isObjectLike({}), true, 'Returns true for an object'); - t.equal(isObjectLike([1, 2, 3]), true, 'Returns true for an array'); - t.equal(isObjectLike(x => x), false, 'Returns false for a function'); - t.equal(isObjectLike(null), false, 'Returns false for null'); + test('Returns true for an object', () => { + expect(isObjectLike({}), true).toBe() +}); + test('Returns true for an array', () => { + expect(isObjectLike([1, 2, 3]), true).toBe() +}); + test('Returns false for a function', () => { + expect(isObjectLike(x => x), false).toBe() +}); + test('Returns false for null', () => { + expect(isObjectLike(null), false).toBe() +}); diff --git a/test/isPlainObject/isPlainObject.test.js b/test/isPlainObject/isPlainObject.test.js index 985a1f704..48aea1309 100644 --- a/test/isPlainObject/isPlainObject.test.js +++ b/test/isPlainObject/isPlainObject.test.js @@ -5,7 +5,11 @@ const isPlainObject = require('./isPlainObject.js'); test('isPlainObject is a Function', () => { expect(isPlainObject).toBeInstanceOf(Function); }); - t.equal(isPlainObject({ a: 1 }), true, 'Returns true for a plain object'); - t.equal(isPlainObject(new Map()), false, 'Returns false for a Map (example of non-plain object)'); + test('Returns true for a plain object', () => { + expect(isPlainObject({ a: 1 }), true).toBe() +}); + test('Returns false for a Map (example of non-plain object)', () => { + expect(isPlainObject(new Map()), false).toBe() +}); diff --git a/test/isPromiseLike/isPromiseLike.test.js b/test/isPromiseLike/isPromiseLike.test.js index a87ceb480..1205dab72 100644 --- a/test/isPromiseLike/isPromiseLike.test.js +++ b/test/isPromiseLike/isPromiseLike.test.js @@ -10,7 +10,11 @@ const isPromiseLike = require('./isPromiseLike.js'); return ''; } }), true, 'Returns true for a promise-like object'); - t.equal(isPromiseLike(null), false, 'Returns false for null'); - t.equal(isPromiseLike({}), false, 'Returns false for an empty object'); + test('Returns false for null', () => { + expect(isPromiseLike(null), false).toBe() +}); + test('Returns false for an empty object', () => { + expect(isPromiseLike({}), false).toBe() +}); diff --git a/test/isSorted/isSorted.test.js b/test/isSorted/isSorted.test.js index 06c7f459b..d6a3d2716 100644 --- a/test/isSorted/isSorted.test.js +++ b/test/isSorted/isSorted.test.js @@ -5,16 +5,38 @@ const isSorted = require('./isSorted.js'); test('isSorted is a Function', () => { expect(isSorted).toBeInstanceOf(Function); }); - t.equal(isSorted([0, 1, 2]), 1, 'Array is sorted in ascending order'); - t.equal(isSorted([0, 1, 2, 2]), 1, 'Array is sorted in ascending order'); - t.equal(isSorted([-4, -3, -2]), 1, 'Array is sorted in ascending order'); - t.equal(isSorted([0, 0, 1, 2]), 1, 'Array is sorted in ascending order'); - t.equal(isSorted([2, 1, 0]), -1, 'Array is sorted in descending order'); - t.equal(isSorted([2, 2, 1, 0]), -1, 'Array is sorted in descending order'); - t.equal(isSorted([-2, -3, -4]), -1, 'Array is sorted in descending order'); - t.equal(isSorted([2, 1, 0, 0]), -1, 'Array is sorted in descending order'); - t.equal(isSorted([]), undefined, 'Array is empty'); - t.equal(isSorted([1]), 0, 'Array is not sorted, direction changed in array'); - t.equal(isSorted([1, 2, 1]), 0, 'Array is not sorted, direction changed in array'); + test('Array is sorted in ascending order', () => { + expect(isSorted([0, 1, 2]), 1).toBe() +}); + test('Array is sorted in ascending order', () => { + expect(isSorted([0, 1, 2, 2]), 1).toBe() +}); + test('Array is sorted in ascending order', () => { + expect(isSorted([-4, -3, -2]), 1).toBe() +}); + test('Array is sorted in ascending order', () => { + expect(isSorted([0, 0, 1, 2]), 1).toBe() +}); + test('Array is sorted in descending order', () => { + expect(isSorted([2, 1, 0]), -1).toBe() +}); + test('Array is sorted in descending order', () => { + expect(isSorted([2, 2, 1, 0]), -1).toBe() +}); + test('Array is sorted in descending order', () => { + expect(isSorted([-2, -3, -4]), -1).toBe() +}); + test('Array is sorted in descending order', () => { + expect(isSorted([2, 1, 0, 0]), -1).toBe() +}); + test('Array is empty', () => { + expect(isSorted([]), undefined).toBe() +}); + test('Array is not sorted, direction changed in array', () => { + expect(isSorted([1]), 0).toBe() +}); + test('Array is not sorted, direction changed in array', () => { + expect(isSorted([1, 2, 1]), 0).toBe() +}); diff --git a/test/isString/isString.test.js b/test/isString/isString.test.js index ce50d62c7..752346b28 100644 --- a/test/isString/isString.test.js +++ b/test/isString/isString.test.js @@ -5,9 +5,19 @@ const isString = require('./isString.js'); test('isString is a Function', () => { expect(isString).toBeInstanceOf(Function); }); - t.equal(isString('foo'), true, 'foo is a string'); - t.equal(isString('10'), true, '"10" is a string'); - t.equal(isString(''), true, 'Empty string is a string'); - t.equal(isString(10), false, '10 is not a string'); - t.equal(isString(true), false, 'true is not string'); + test('foo is a string', () => { + expect(isString('foo'), true).toBe() +}); + test('"10" is a string', () => { + expect(isString('10'), true).toBe() +}); + test('Empty string is a string', () => { + expect(isString(''), true).toBe() +}); + test('10 is not a string', () => { + expect(isString(10), false).toBe() +}); + test('true is not string', () => { + expect(isString(true), false).toBe() +}); diff --git a/test/isUpperCase/isUpperCase.test.js b/test/isUpperCase/isUpperCase.test.js index a50c7aa2a..650e0775a 100644 --- a/test/isUpperCase/isUpperCase.test.js +++ b/test/isUpperCase/isUpperCase.test.js @@ -5,7 +5,13 @@ const isUpperCase = require('./isUpperCase.js'); test('isUpperCase is a Function', () => { expect(isUpperCase).toBeInstanceOf(Function); }); - t.equal(isUpperCase('ABC'), true, 'ABC is all upper case'); - t.equal(isUpperCase('abc'), false, 'abc is not all upper case'); - t.equal(isUpperCase('A3@$'), true, 'A3@$ is all uppercase'); + test('ABC is all upper case', () => { + expect(isUpperCase('ABC'), true).toBe() +}); + test('abc is not all upper case', () => { + expect(isUpperCase('abc'), false).toBe() +}); + test('A3@$ is all uppercase', () => { + expect(isUpperCase('A3@$'), true).toBe() +}); diff --git a/test/isValidJSON/isValidJSON.test.js b/test/isValidJSON/isValidJSON.test.js index 8ab0fd2fa..499d27685 100644 --- a/test/isValidJSON/isValidJSON.test.js +++ b/test/isValidJSON/isValidJSON.test.js @@ -5,7 +5,13 @@ const isValidJSON = require('./isValidJSON.js'); test('isValidJSON is a Function', () => { expect(isValidJSON).toBeInstanceOf(Function); }); - t.equal(isValidJSON('{"name":"Adam","age":20}'), true, '{"name":"Adam","age":20} is a valid JSON'); - t.equal(isValidJSON('{"name":"Adam",age:"20"}'), false, '{"name":"Adam",age:"20"} is not a valid JSON'); - t.equal(isValidJSON(null), true, 'null is a valid JSON'); + test('{"name":"Adam","age":20} is a valid JSON', () => { + expect(isValidJSON('{"name":"Adam","age":20}'), true).toBe() +}); + test('{"name":"Adam",age:"20"} is not a valid JSON', () => { + expect(isValidJSON('{"name":"Adam",age:"20"}'), false).toBe() +}); + test('null is a valid JSON', () => { + expect(isValidJSON(null), true).toBe() +}); diff --git a/test/last/last.test.js b/test/last/last.test.js index f2d4081a1..282177e82 100644 --- a/test/last/last.test.js +++ b/test/last/last.test.js @@ -9,8 +9,12 @@ const last = require('./last.js'); expect(last({ a: 1234}) === undefined).toBeTruthy(); }); t.equal(last([1, 2, 3]), 3, "last([1, 2, 3]) returns 3"); - t.equal(last({ 0: false}), undefined, 'last({ 0: false}) returns undefined'); - t.equal(last('String'), 'g', 'last(String) returns g'); + test('last({ 0: false}) returns undefined', () => { + expect(last({ 0: false}), undefined).toBe() +}); + test('last(String) returns g', () => { + expect(last('String'), 'g').toBe() +}); t.throws(() => last(null), 'last(null) throws an Error'); t.throws(() => last(undefined), 'last(undefined) throws an Error'); t.throws(() => last(), 'last() throws an Error'); diff --git a/test/lowercaseKeys/lowercaseKeys.test.js b/test/lowercaseKeys/lowercaseKeys.test.js index eb0c9bd02..ad8077094 100644 --- a/test/lowercaseKeys/lowercaseKeys.test.js +++ b/test/lowercaseKeys/lowercaseKeys.test.js @@ -7,7 +7,11 @@ const lowercaseKeys = require('./lowercaseKeys.js'); }); const myObj = { Name: 'Adam', sUrnAME: 'Smith' }; const myObjLower = lowercaseKeys(myObj); - t.deepEqual(myObjLower, {name: 'Adam', surname: 'Smith'}, 'Lowercases object keys'); - t.deepEqual(myObj, { Name: 'Adam', sUrnAME: 'Smith' }, 'Does not mutate original object'); + test('Lowercases object keys', () => { + expect(myObjLower, {name: 'Adam', surname: 'Smith'}).toEqual() +}); + test('Does not mutate original object', () => { + expect(myObj, { Name: 'Adam', sUrnAME: 'Smith' }).toEqual() +}); diff --git a/test/mapKeys/mapKeys.test.js b/test/mapKeys/mapKeys.test.js index 312dadee9..cec228c64 100644 --- a/test/mapKeys/mapKeys.test.js +++ b/test/mapKeys/mapKeys.test.js @@ -5,6 +5,8 @@ const mapKeys = require('./mapKeys.js'); test('mapKeys is a Function', () => { expect(mapKeys).toBeInstanceOf(Function); }); - t.deepEqual(mapKeys({ a: 1, b: 2 }, (val, key) => key + val), { a1: 1, b2: 2 }, 'Maps keys'); + test('Maps keys', () => { + expect(mapKeys({ a: 1, b: 2 }, (val, key) => key + val), { a1: 1, b2: 2 }).toEqual() +}); diff --git a/test/mapObject/mapObject.test.js b/test/mapObject/mapObject.test.js index 2c3b5a01d..2b00337b8 100644 --- a/test/mapObject/mapObject.test.js +++ b/test/mapObject/mapObject.test.js @@ -6,7 +6,11 @@ const mapObject = require('./mapObject.js'); expect(mapObject).toBeInstanceOf(Function); }); t.deepEqual(mapObject([1, 2, 3], a => a * a), { 1: 1, 2: 4, 3: 9 }, "mapObject([1, 2, 3], a => a * a) returns { 1: 1, 2: 4, 3: 9 }"); - t.deepEqual(mapObject([1, 2, 3, 4], (a, b) => b - a), { 1: -1, 2: -1, 3: -1, 4: -1 }, 'mapObject([1, 2, 3, 4], (a, b) => b - a) returns { 1: -1, 2: -1, 3: -1, 4: -1 }'); - t.deepEqual(mapObject([1, 2, 3, 4], (a, b) => a - b), { 1: 1, 2: 1, 3: 1, 4: 1 }, 'mapObject([1, 2, 3, 4], (a, b) => a - b) returns { 1: 1, 2: 1, 3: 1, 4: 1 }'); + 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) => 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() +}); diff --git a/test/mapValues/mapValues.test.js b/test/mapValues/mapValues.test.js index 75ab17b96..f8b315256 100644 --- a/test/mapValues/mapValues.test.js +++ b/test/mapValues/mapValues.test.js @@ -9,6 +9,8 @@ const mapValues = require('./mapValues.js'); fred: { user: 'fred', age: 40 }, pebbles: { user: 'pebbles', age: 1 } }; - t.deepEqual(mapValues(users, u => u.age), { fred: 40, pebbles: 1 }, 'Maps values'); + test('Maps values', () => { + expect(mapValues(users, u => u.age), { fred: 40, pebbles: 1 }).toEqual() +}); diff --git a/test/memoize/memoize.test.js b/test/memoize/memoize.test.js index f646ed27a..1d7bf83e1 100644 --- a/test/memoize/memoize.test.js +++ b/test/memoize/memoize.test.js @@ -7,8 +7,14 @@ const memoize = require('./memoize.js'); }); const f = x => x * x; const square = memoize(f); - t.equal(square(2), 4, 'Function works properly'); - t.equal(square(3), 9, 'Function works properly'); - t.deepEqual(Array.from(square.cache), [[2,4],[3,9]], 'Cache stores values'); + test('Function works properly', () => { + expect(square(2), 4).toBe() +}); + test('Function works properly', () => { + expect(square(3), 9).toBe() +}); + test('Cache stores values', () => { + expect(Array.from(square.cache), [[2,4],[3,9]]).toEqual() +}); diff --git a/test/merge/merge.test.js b/test/merge/merge.test.js index 337c466ca..34ebec62f 100644 --- a/test/merge/merge.test.js +++ b/test/merge/merge.test.js @@ -14,6 +14,8 @@ const merge = require('./merge.js'); b: [2, 3], c: 'foo' }; - t.deepEqual(merge(object, other), { a: [ { x: 2 }, { y: 4 }, { z: 3 } ], b: [ 1, 2, 3 ], c: 'foo' }, 'Merges two objects'); + test('Merges two objects', () => { + expect(merge(object, other), { a: [ { x: 2 }, { y: 4 }, { z: 3 } ], b: [ 1, 2, 3 ], c: 'foo' }).toEqual() +}); diff --git a/test/mostPerformant/mostPerformant.test.js b/test/mostPerformant/mostPerformant.test.js index cffb718a6..934e8667b 100644 --- a/test/mostPerformant/mostPerformant.test.js +++ b/test/mostPerformant/mostPerformant.test.js @@ -5,6 +5,6 @@ const mostPerformant = require('./mostPerformant.js'); test('mostPerformant is a Function', () => { expect(mostPerformant).toBeInstanceOf(Function); }); - t.pass('Tested by @chalarangelo on 16/02/2018'); + diff --git a/test/nthArg/nthArg.test.js b/test/nthArg/nthArg.test.js index edbce4300..1fe0d7568 100644 --- a/test/nthArg/nthArg.test.js +++ b/test/nthArg/nthArg.test.js @@ -6,9 +6,15 @@ const nthArg = require('./nthArg.js'); expect(nthArg).toBeInstanceOf(Function); }); const third = nthArg(2); - t.equal(third(1, 2, 3), 3, 'Returns the nth argument'); - t.equal(third(1, 2), undefined, 'Returns undefined if arguments too few'); + test('Returns the nth argument', () => { + expect(third(1, 2, 3), 3).toBe() +}); + test('Returns undefined if arguments too few', () => { + expect(third(1, 2), undefined).toBe() +}); const last = nthArg(-1); - t.equal(last(1, 2, 3, 4, 5), 5, 'Works for negative values'); + test('Works for negative values', () => { + expect(last(1, 2, 3, 4, 5), 5).toBe() +}); diff --git a/test/observeMutations/observeMutations.test.js b/test/observeMutations/observeMutations.test.js index 9de9fd425..1b6330663 100644 --- a/test/observeMutations/observeMutations.test.js +++ b/test/observeMutations/observeMutations.test.js @@ -5,6 +5,6 @@ const observeMutations = require('./observeMutations.js'); test('observeMutations is a Function', () => { expect(observeMutations).toBeInstanceOf(Function); }); - t.pass('Tested on 09/02/2018 by @chalarangelo'); + diff --git a/test/off/off.test.js b/test/off/off.test.js index ab48b3167..dc897dfcd 100644 --- a/test/off/off.test.js +++ b/test/off/off.test.js @@ -5,6 +5,6 @@ const off = require('./off.js'); test('off is a Function', () => { expect(off).toBeInstanceOf(Function); }); - t.pass('Tested by @chalarangelo on 16/02/2018'); + diff --git a/test/offset/offset.test.js b/test/offset/offset.test.js index cf2622bf1..089f1ca48 100644 --- a/test/offset/offset.test.js +++ b/test/offset/offset.test.js @@ -5,11 +5,23 @@ const offset = require('./offset.js'); test('offset is a Function', () => { expect(offset).toBeInstanceOf(Function); }); - t.deepEqual(offset([1, 2, 3, 4, 5], 0), [1, 2, 3, 4, 5], 'Offset of 0 returns the same array.'); - t.deepEqual(offset([1, 2, 3, 4, 5], 2), [3, 4, 5, 1, 2], 'Offset > 0 returns the offsetted array.'); - t.deepEqual(offset([1, 2, 3, 4, 5], -2), [4, 5, 1, 2, 3], 'Offset < 0 returns the reverse offsetted array.'); - t.deepEqual(offset([1, 2, 3, 4, 5], 6),[1, 2, 3, 4, 5], 'Offset greater than the length of the array returns the same array.'); - t.deepEqual(offset([1, 2, 3, 4, 5], -6), [1, 2, 3, 4, 5], 'Offset less than the negative length of the array returns the same array.'); - t.deepEqual(offset([], 3), [], 'Offsetting empty array returns an empty array.'); + test('Offset of 0 returns the same array.', () => { + expect(offset([1, 2, 3, 4, 5], 0), [1, 2, 3, 4, 5]).toEqual() +}); + test('Offset > 0 returns the offsetted array.', () => { + expect(offset([1, 2, 3, 4, 5], 2), [3, 4, 5, 1, 2]).toEqual() +}); + test('Offset < 0 returns the reverse offsetted array.', () => { + expect(offset([1, 2, 3, 4, 5], -2), [4, 5, 1, 2, 3]).toEqual() +}); + test('Offset greater than the length of the array returns the same array.', () => { + expect(offset([1, 2, 3, 4, 5], 6),[1, 2, 3, 4, 5]).toEqual() +}); + test('Offset less than the negative length of the array returns the same array.', () => { + expect(offset([1, 2, 3, 4, 5], -6), [1, 2, 3, 4, 5]).toEqual() +}); + test('Offsetting empty array returns an empty array.', () => { + expect(offset([], 3), []).toEqual() +}); diff --git a/test/omit/omit.test.js b/test/omit/omit.test.js index 3629dfc96..eca259073 100644 --- a/test/omit/omit.test.js +++ b/test/omit/omit.test.js @@ -5,6 +5,8 @@ const omit = require('./omit.js'); test('omit is a Function', () => { expect(omit).toBeInstanceOf(Function); }); - t.deepEqual(omit({ a: 1, b: '2', c: 3 }, ['b']), { 'a': 1, 'c': 3 }, 'Omits the key-value pairs corresponding to the given keys from an object'); + test('Omits the key-value pairs corresponding to the given keys from an object', () => { + expect(omit({ a: 1, b: '2', c: 3 }, ['b']), { 'a': 1, 'c': 3 }).toEqual() +}); diff --git a/test/omitBy/omitBy.test.js b/test/omitBy/omitBy.test.js index 586bbd6b9..8fc3d26d9 100644 --- a/test/omitBy/omitBy.test.js +++ b/test/omitBy/omitBy.test.js @@ -5,6 +5,8 @@ const omitBy = require('./omitBy.js'); test('omitBy is a Function', () => { expect(omitBy).toBeInstanceOf(Function); }); - t.deepEqual(omitBy({ a: 1, b: '2', c: 3 }, x => typeof x === 'number'), { b: '2' }, 'Creates an object composed of the properties the given function returns falsey for'); + 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'), { b: '2' }).toEqual() +}); diff --git a/test/on/on.test.js b/test/on/on.test.js index 8496fd977..d681556c5 100644 --- a/test/on/on.test.js +++ b/test/on/on.test.js @@ -5,6 +5,6 @@ const on = require('./on.js'); test('on is a Function', () => { expect(on).toBeInstanceOf(Function); }); - t.pass('Tested by @chalarangelo on 16/02/2018'); + diff --git a/test/onUserInputChange/onUserInputChange.test.js b/test/onUserInputChange/onUserInputChange.test.js index a31a50a88..8894c8a0c 100644 --- a/test/onUserInputChange/onUserInputChange.test.js +++ b/test/onUserInputChange/onUserInputChange.test.js @@ -5,6 +5,6 @@ const onUserInputChange = require('./onUserInputChange.js'); test('onUserInputChange is a Function', () => { expect(onUserInputChange).toBeInstanceOf(Function); }); - t.pass('Tested by @chalarangelo on 16/02/2018'); + diff --git a/test/once/once.test.js b/test/once/once.test.js index c8ea9c9e9..04d9a77ed 100644 --- a/test/once/once.test.js +++ b/test/once/once.test.js @@ -5,6 +5,6 @@ const once = require('./once.js'); test('once is a Function', () => { expect(once).toBeInstanceOf(Function); }); - t.pass('Tested by @chalarangelo on 16/02/2018'); + diff --git a/test/over/over.test.js b/test/over/over.test.js index 8ed724cfb..7071bf09f 100644 --- a/test/over/over.test.js +++ b/test/over/over.test.js @@ -6,6 +6,8 @@ const over = require('./over.js'); expect(over).toBeInstanceOf(Function); }); const minMax = over(Math.min, Math.max); - t.deepEqual(minMax(1, 2, 3, 4, 5), [1,5], 'Applies given functions over multiple arguments'); + test('Applies given functions over multiple arguments', () => { + expect(minMax(1, 2, 3, 4, 5), [1,5]).toEqual() +}); diff --git a/test/overArgs/overArgs.test.js b/test/overArgs/overArgs.test.js index 19cce2cfa..0127c5993 100644 --- a/test/overArgs/overArgs.test.js +++ b/test/overArgs/overArgs.test.js @@ -8,6 +8,8 @@ const overArgs = require('./overArgs.js'); const square = n => n * n; const double = n => n * 2; const fn = overArgs((x, y) => [x, y], [square, double]); - t.deepEqual(fn(9, 3), [81, 6], 'Invokes the provided function with its arguments transformed'); + test('Invokes the provided function with its arguments transformed', () => { + expect(fn(9, 3), [81, 6]).toEqual() +}); diff --git a/test/pad/pad.test.js b/test/pad/pad.test.js index f01524b50..1b797df95 100644 --- a/test/pad/pad.test.js +++ b/test/pad/pad.test.js @@ -5,9 +5,17 @@ const pad = require('./pad.js'); test('pad is a Function', () => { expect(pad).toBeInstanceOf(Function); }); - t.equal(pad('cat',8), ' cat ', 'cat is padded on both sides'); - t.equal(pad('cat',8).length, 8, 'length of string is 8'); - t.equal(pad(String(42), 6, '0'), '004200', 'pads 42 with "0"'); - t.equal(pad('foobar', 3), 'foobar', 'does not truncates if string exceeds length'); + test('cat is padded on both sides', () => { + expect(pad('cat',8), ' cat ').toBe() +}); + test('length of string is 8', () => { + expect(pad('cat',8).length, 8).toBe() +}); + test('pads 42 with "0"', () => { + expect(pad(String(42), 6, '0'), '004200').toBe() +}); + test('does not truncates if string exceeds length', () => { + expect(pad('foobar', 3), 'foobar').toBe() +}); diff --git a/test/parseCookie/parseCookie.test.js b/test/parseCookie/parseCookie.test.js index b1c64e056..d7494447f 100644 --- a/test/parseCookie/parseCookie.test.js +++ b/test/parseCookie/parseCookie.test.js @@ -5,6 +5,8 @@ const parseCookie = require('./parseCookie.js'); test('parseCookie is a Function', () => { expect(parseCookie).toBeInstanceOf(Function); }); - t.deepEqual(parseCookie('foo=bar; equation=E%3Dmc%5E2'), { foo: 'bar', equation: 'E=mc^2' }, 'Parses the cookie'); + test('Parses the cookie', () => { + expect(parseCookie('foo=bar; equation=E%3Dmc%5E2'), { foo: 'bar', equation: 'E=mc^2' }).toEqual() +}); diff --git a/test/partial/partial.test.js b/test/partial/partial.test.js index d9dc5dbf5..8052974d4 100644 --- a/test/partial/partial.test.js +++ b/test/partial/partial.test.js @@ -9,6 +9,8 @@ const partial = require('./partial.js'); return greeting + ' ' + name + '!'; } const greetHello = partial(greet, 'Hello'); - t.equal(greetHello('John'), 'Hello John!', 'Prepends arguments'); + test('Prepends arguments', () => { + expect(greetHello('John'), 'Hello John!').toBe() +}); diff --git a/test/partialRight/partialRight.test.js b/test/partialRight/partialRight.test.js index d5e29fe1a..ee2006517 100644 --- a/test/partialRight/partialRight.test.js +++ b/test/partialRight/partialRight.test.js @@ -9,6 +9,8 @@ const partialRight = require('./partialRight.js'); return greeting + ' ' + name + '!'; } const greetJohn = partialRight(greet, 'John'); - t.equal(greetJohn('Hello'), 'Hello John!', 'Appends arguments'); + test('Appends arguments', () => { + expect(greetJohn('Hello'), 'Hello John!').toBe() +}); diff --git a/test/permutations/permutations.test.js b/test/permutations/permutations.test.js index 3b1ffac73..9962dc9b8 100644 --- a/test/permutations/permutations.test.js +++ b/test/permutations/permutations.test.js @@ -5,6 +5,8 @@ const permutations = require('./permutations.js'); test('permutations is a Function', () => { expect(permutations).toBeInstanceOf(Function); }); - t.deepEqual(permutations([1, 33, 5]), [ [ 1, 33, 5 ], [ 1, 5, 33 ], [ 33, 1, 5 ], [ 33, 5, 1 ], [ 5, 1, 33 ], [ 5, 33, 1 ] ], 'Generates all permutations of an array'); + test('Generates all permutations of an array', () => { + expect(permutations([1, 33, 5]), [ [ 1, 33, 5 ], [ 1, 5, 33 ], [ 33, 1, 5 ], [ 33, 5, 1 ], [ 5, 1, 33 ], [ 5, 33, 1 ] ]).toEqual() +}); diff --git a/test/pickBy/pickBy.test.js b/test/pickBy/pickBy.test.js index d0e5d9b19..39c1d1420 100644 --- a/test/pickBy/pickBy.test.js +++ b/test/pickBy/pickBy.test.js @@ -5,6 +5,8 @@ const pickBy = require('./pickBy.js'); test('pickBy is a Function', () => { expect(pickBy).toBeInstanceOf(Function); }); - t.deepEqual(pickBy({ a: 1, b: '2', c: 3 }, x => typeof x === 'number'), { 'a': 1, 'c': 3 }, 'Creates an object composed of the properties the given function returns truthy for.'); + 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'), { 'a': 1, 'c': 3 }).toEqual() +}); diff --git a/test/pipeFunctions/pipeFunctions.test.js b/test/pipeFunctions/pipeFunctions.test.js index ddf1a3c0d..1f44b75e1 100644 --- a/test/pipeFunctions/pipeFunctions.test.js +++ b/test/pipeFunctions/pipeFunctions.test.js @@ -8,6 +8,8 @@ const pipeFunctions = require('./pipeFunctions.js'); const add5 = x => x + 5; const multiply = (x, y) => x * y; const multiplyAndAdd5 = pipeFunctions(multiply, add5); - t.equal(multiplyAndAdd5(5, 2), 15, 'Performs left-to-right function composition'); + test('Performs left-to-right function composition', () => { + expect(multiplyAndAdd5(5, 2), 15).toBe() +}); diff --git a/test/pluralize/pluralize.test.js b/test/pluralize/pluralize.test.js index 7f2147e2d..570d16520 100644 --- a/test/pluralize/pluralize.test.js +++ b/test/pluralize/pluralize.test.js @@ -5,15 +5,25 @@ const pluralize = require('./pluralize.js'); test('pluralize is a Function', () => { expect(pluralize).toBeInstanceOf(Function); }); - t.equal(pluralize(0, 'apple'), 'apples', 'Produces the plural of the word'); - t.equal(pluralize(1, 'apple'), 'apple', 'Produces the singular of the word'); - t.equal(pluralize(2, 'apple'), 'apples', 'Produces the plural of the word'); - t.equal(pluralize(2, 'person', 'people'), 'people', 'Prodices the defined plural of the word'); + test('Produces the plural of the word', () => { + expect(pluralize(0, 'apple'), 'apples').toBe() +}); + test('Produces the singular of the word', () => { + expect(pluralize(1, 'apple'), 'apple').toBe() +}); + test('Produces the plural of the word', () => { + expect(pluralize(2, 'apple'), 'apples').toBe() +}); + test('Prodices the defined plural of the word', () => { + expect(pluralize(2, 'person', 'people'), 'people').toBe() +}); const PLURALS = { person: 'people', radius: 'radii' }; const autoPluralize = pluralize(PLURALS); - t.equal(autoPluralize(2, 'person'), 'people', 'Works with a dictionary'); + test('Works with a dictionary', () => { + expect(autoPluralize(2, 'person'), 'people').toBe() +}); diff --git a/test/promisify/promisify.test.js b/test/promisify/promisify.test.js index 53b656aeb..52a4ed876 100644 --- a/test/promisify/promisify.test.js +++ b/test/promisify/promisify.test.js @@ -10,6 +10,6 @@ const promisify = require('./promisify.js'); expect(x() instanceof Promise).toBeTruthy(); }); const delay = promisify((d, cb) => setTimeout(cb, d)); - delay(200).then(() => t.pass('Runs the function provided')); + delay(200).then(() => diff --git a/test/pull/pull.test.js b/test/pull/pull.test.js index c7458e3a2..f68af2f57 100644 --- a/test/pull/pull.test.js +++ b/test/pull/pull.test.js @@ -7,6 +7,8 @@ const pull = require('./pull.js'); }); let myArray = ['a', 'b', 'c', 'a', 'b', 'c']; pull(myArray, 'a', 'c'); - t.deepEqual(myArray, ['b','b'], 'Pulls the specified values'); + test('Pulls the specified values', () => { + expect(myArray, ['b','b']).toEqual() +}); diff --git a/test/pullAtIndex/pullAtIndex.test.js b/test/pullAtIndex/pullAtIndex.test.js index 08db4f15d..a476f9496 100644 --- a/test/pullAtIndex/pullAtIndex.test.js +++ b/test/pullAtIndex/pullAtIndex.test.js @@ -7,7 +7,11 @@ const pullAtIndex = require('./pullAtIndex.js'); }); let myArray = ['a', 'b', 'c', 'd']; let pulled = pullAtIndex(myArray, [1, 3]); - t.deepEqual(myArray, [ 'a', 'c' ], 'Pulls the given values'); - t.deepEqual(pulled, [ 'b', 'd' ], 'Pulls the given values'); + test('Pulls the given values', () => { + expect(myArray, [ 'a', 'c' ]).toEqual() +}); + test('Pulls the given values', () => { + expect(pulled, [ 'b', 'd' ]).toEqual() +}); diff --git a/test/pullAtValue/pullAtValue.test.js b/test/pullAtValue/pullAtValue.test.js index bbf850ca8..26bdf35ea 100644 --- a/test/pullAtValue/pullAtValue.test.js +++ b/test/pullAtValue/pullAtValue.test.js @@ -7,7 +7,11 @@ const pullAtValue = require('./pullAtValue.js'); }); let myArray = ['a', 'b', 'c', 'd']; let pulled = pullAtValue(myArray, ['b', 'd']); - t.deepEqual(myArray, [ 'a', 'c' ], 'Pulls the specified values'); - t.deepEqual(pulled, [ 'b', 'd' ], 'Pulls the specified values'); + test('Pulls the specified values', () => { + expect(myArray, [ 'a', 'c' ]).toEqual() +}); + test('Pulls the specified values', () => { + expect(pulled, [ 'b', 'd' ]).toEqual() +}); diff --git a/test/pullBy/pullBy.test.js b/test/pullBy/pullBy.test.js index f01205590..6a6dc7d8c 100644 --- a/test/pullBy/pullBy.test.js +++ b/test/pullBy/pullBy.test.js @@ -7,6 +7,8 @@ const pullBy = require('./pullBy.js'); }); var myArray = [{ x: 1 }, { x: 2 }, { x: 3 }, { x: 1 }]; pullBy(myArray, [{ x: 1 }, { x: 3 }], o => o.x); - t.deepEqual(myArray, [{ x: 2 }], 'Pulls the specified values'); + test('Pulls the specified values', () => { + expect(myArray, [{ x: 2 }]).toEqual() +}); diff --git a/test/quickSort/quickSort.test.js b/test/quickSort/quickSort.test.js index 693eb3da0..a9b37e0d5 100644 --- a/test/quickSort/quickSort.test.js +++ b/test/quickSort/quickSort.test.js @@ -5,8 +5,12 @@ const quickSort = require('./quickSort.js'); test('quickSort is a Function', () => { expect(quickSort).toBeInstanceOf(Function); }); - t.deepEqual(quickSort([5, 6, 4, 3, 1, 2]), [1, 2, 3, 4, 5, 6], 'quickSort([5, 6, 4, 3, 1, 2]) returns [1, 2, 3, 4, 5, 6]'); - t.deepEqual(quickSort([-1, 0, -2]), [-2, -1, 0], 'quickSort([-1, 0, -2]) returns [-2, -1, 0]'); + test('quickSort([5, 6, 4, 3, 1, 2]) returns [1, 2, 3, 4, 5, 6]', () => { + expect(quickSort([5, 6, 4, 3, 1, 2]), [1, 2, 3, 4, 5, 6]).toEqual() +}); + test('quickSort([-1, 0, -2]) returns [-2, -1, 0]', () => { + expect(quickSort([-1, 0, -2]), [-2, -1, 0]).toEqual() +}); t.throws(() => quickSort(), 'quickSort() throws an error'); t.throws(() => quickSort(123), 'quickSort(123) throws an error'); t.throws(() => quickSort({ 234: string}), 'quickSort({ 234: string}) throws an error'); diff --git a/test/radsToDegrees/radsToDegrees.test.js b/test/radsToDegrees/radsToDegrees.test.js index 2a65a6c78..e8e2cd6dd 100644 --- a/test/radsToDegrees/radsToDegrees.test.js +++ b/test/radsToDegrees/radsToDegrees.test.js @@ -5,6 +5,8 @@ const radsToDegrees = require('./radsToDegrees.js'); test('radsToDegrees is a Function', () => { expect(radsToDegrees).toBeInstanceOf(Function); }); - t.equal(radsToDegrees(Math.PI / 2), 90, 'Returns the appropriate value'); + test('Returns the appropriate value', () => { + expect(radsToDegrees(Math.PI / 2), 90).toBe() +}); diff --git a/test/randomIntArrayInRange/randomIntArrayInRange.test.js b/test/randomIntArrayInRange/randomIntArrayInRange.test.js index 40b0635ef..1a58271fa 100644 --- a/test/randomIntArrayInRange/randomIntArrayInRange.test.js +++ b/test/randomIntArrayInRange/randomIntArrayInRange.test.js @@ -11,7 +11,9 @@ const randomIntArrayInRange = require('./randomIntArrayInRange.js'); test('The returned array contains only integers', () => { expect(arr.every(x => typeof x === 'number')).toBeTruthy(); }); - t.equal(arr.length, 10, 'The returned array has the proper length'); + test('The returned array has the proper length', () => { + expect(arr.length, 10).toBe() +}); 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/readFileLines/readFileLines.test.js b/test/readFileLines/readFileLines.test.js index 1590f08c0..800f0ef4c 100644 --- a/test/readFileLines/readFileLines.test.js +++ b/test/readFileLines/readFileLines.test.js @@ -5,6 +5,6 @@ const readFileLines = require('./readFileLines.js'); test('readFileLines is a Function', () => { expect(readFileLines).toBeInstanceOf(Function); }); - t.pass('Tested on 09/02/2018 by @chalarangelo'); + diff --git a/test/rearg/rearg.test.js b/test/rearg/rearg.test.js index a15e44b93..c2cd186cf 100644 --- a/test/rearg/rearg.test.js +++ b/test/rearg/rearg.test.js @@ -11,6 +11,8 @@ const rearg = require('./rearg.js'); }, [2, 0, 1] ); - t.deepEqual(rearged('b', 'c', 'a'), ['a', 'b', 'c'], 'Reorders arguments in invoked function'); + test('Reorders arguments in invoked function', () => { + expect(rearged('b', 'c', 'a'), ['a', 'b', 'c']).toEqual() +}); diff --git a/test/redirect/redirect.test.js b/test/redirect/redirect.test.js index 680d23ec5..e6d1e43b7 100644 --- a/test/redirect/redirect.test.js +++ b/test/redirect/redirect.test.js @@ -5,6 +5,6 @@ const redirect = require('./redirect.js'); test('redirect is a Function', () => { expect(redirect).toBeInstanceOf(Function); }); - t.pass('Tested on 09/02/2018 by @chalarangelo'); + diff --git a/test/reduceSuccessive/reduceSuccessive.test.js b/test/reduceSuccessive/reduceSuccessive.test.js index d78e659d6..67afd53df 100644 --- a/test/reduceSuccessive/reduceSuccessive.test.js +++ b/test/reduceSuccessive/reduceSuccessive.test.js @@ -5,6 +5,8 @@ const reduceSuccessive = require('./reduceSuccessive.js'); test('reduceSuccessive is a Function', () => { expect(reduceSuccessive).toBeInstanceOf(Function); }); - t.deepEqual(reduceSuccessive([1, 2, 3, 4, 5, 6], (acc, val) => acc + val, 0), [0, 1, 3, 6, 10, 15, 21], 'Returns the array of successively reduced values'); + test('Returns the array of successively reduced values', () => { + expect(reduceSuccessive([1, 2, 3, 4, 5, 6], (acc, val) => acc + val, 0), [0, 1, 3, 6, 10, 15, 21]).toEqual() +}); diff --git a/test/reduceWhich/reduceWhich.test.js b/test/reduceWhich/reduceWhich.test.js index 4d6929507..832168d05 100644 --- a/test/reduceWhich/reduceWhich.test.js +++ b/test/reduceWhich/reduceWhich.test.js @@ -5,8 +5,12 @@ const reduceWhich = require('./reduceWhich.js'); test('reduceWhich is a Function', () => { expect(reduceWhich).toBeInstanceOf(Function); }); - t.equal(reduceWhich([1, 3, 2]), 1, 'Returns the minimum of an array'); - t.equal(reduceWhich([1, 3, 2], (a, b) => b - a), 3, 'Returns the maximum of an array'); + test('Returns the minimum of an array', () => { + expect(reduceWhich([1, 3, 2]), 1).toBe() +}); + test('Returns the maximum of an array', () => { + expect(reduceWhich([1, 3, 2], (a, b) => b - a), 3).toBe() +}); t.deepEqual(reduceWhich( [{ name: 'Tom', age: 12 }, { name: 'Jack', age: 18 }, { name: 'Lucy', age: 9 }], (a, b) => a.age - b.age diff --git a/test/removeNonASCII/removeNonASCII.test.js b/test/removeNonASCII/removeNonASCII.test.js index a33c12a00..24b88a86e 100644 --- a/test/removeNonASCII/removeNonASCII.test.js +++ b/test/removeNonASCII/removeNonASCII.test.js @@ -5,6 +5,8 @@ const removeNonASCII = require('./removeNonASCII.js'); test('removeNonASCII is a Function', () => { expect(removeNonASCII).toBeInstanceOf(Function); }); - t.equal(removeNonASCII('ÀÄçÇéÉĂȘlorem-ipsumĂ¶Ă–ĂĂŸĂșÚ'), 'lorem-ipsum', 'Removes non-ASCII characters'); + test('Removes non-ASCII characters', () => { + expect(removeNonASCII('ÀÄçÇéÉĂȘlorem-ipsumĂ¶Ă–ĂĂŸĂșÚ'), 'lorem-ipsum').toBe() +}); diff --git a/test/runAsync/runAsync.test.js b/test/runAsync/runAsync.test.js index 7606a8cfb..8528fdb07 100644 --- a/test/runAsync/runAsync.test.js +++ b/test/runAsync/runAsync.test.js @@ -5,6 +5,6 @@ const runAsync = require('./runAsync.js'); test('runAsync is a Function', () => { expect(runAsync).toBeInstanceOf(Function); }); - t.pass('Tested on 09/02/2018 by @chalarangelo'); + diff --git a/test/runPromisesInSeries/runPromisesInSeries.test.js b/test/runPromisesInSeries/runPromisesInSeries.test.js index 646172e0e..88ac6ea82 100644 --- a/test/runPromisesInSeries/runPromisesInSeries.test.js +++ b/test/runPromisesInSeries/runPromisesInSeries.test.js @@ -6,6 +6,6 @@ const runPromisesInSeries = require('./runPromisesInSeries.js'); expect(runPromisesInSeries).toBeInstanceOf(Function); }); const delay = d => new Promise(r => setTimeout(r, d)); - runPromisesInSeries([() => delay(100), () => delay(200).then(() => t.pass('Runs promises in series'))]); + runPromisesInSeries([() => delay(100), () => delay(200).then(() => diff --git a/test/sample/sample.test.js b/test/sample/sample.test.js index caf8ccd45..38902e272 100644 --- a/test/sample/sample.test.js +++ b/test/sample/sample.test.js @@ -9,7 +9,11 @@ const sample = require('./sample.js'); test('Returns a random element from the array', () => { expect(arr.includes(sample(arr))).toBeTruthy(); }); - t.equal(sample([1]), 1, 'Works for single-element arrays'); - t.equal(sample([]), undefined, 'Returns undefined for empty array'); + test('Works for single-element arrays', () => { + expect(sample([1]), 1).toBe() +}); + test('Returns undefined for empty array', () => { + expect(sample([]), undefined).toBe() +}); diff --git a/test/sampleSize/sampleSize.test.js b/test/sampleSize/sampleSize.test.js index f56f1b5cb..9edcd69c6 100644 --- a/test/sampleSize/sampleSize.test.js +++ b/test/sampleSize/sampleSize.test.js @@ -6,12 +6,20 @@ const sampleSize = require('./sampleSize.js'); expect(sampleSize).toBeInstanceOf(Function); }); const arr = [3,7,9,11]; - t.equal(sampleSize(arr).length, 1, 'Returns a single element without n specified'); + test('Returns a single element without n specified', () => { + expect(sampleSize(arr).length, 1).toBe() +}); test('Returns a random sample of specified size from an array', () => { expect(sampleSize(arr, 2).every(x => arr.includes(x))).toBeTruthy(); }); - t.equal(sampleSize(arr, 5).length, 4, 'Returns all elements in an array if n >= length'); - t.deepEqual(sampleSize([], 2), [], 'Returns an empty array if original array is empty'); - t.deepEqual(sampleSize(arr, 0), [], 'Returns an empty array if n = 0'); + test('Returns all elements in an array if n >= length', () => { + expect(sampleSize(arr, 5).length, 4).toBe() +}); + test('Returns an empty array if original array is empty', () => { + expect(sampleSize([], 2), []).toEqual() +}); + test('Returns an empty array if n = 0', () => { + expect(sampleSize(arr, 0), []).toEqual() +}); diff --git a/test/scrollToTop/scrollToTop.test.js b/test/scrollToTop/scrollToTop.test.js index 37afc3739..0c44b1a53 100644 --- a/test/scrollToTop/scrollToTop.test.js +++ b/test/scrollToTop/scrollToTop.test.js @@ -5,6 +5,6 @@ const scrollToTop = require('./scrollToTop.js'); test('scrollToTop is a Function', () => { expect(scrollToTop).toBeInstanceOf(Function); }); - t.pass('Tested on 09/02/2018 by @chalarangelo'); + diff --git a/test/serializeCookie/serializeCookie.test.js b/test/serializeCookie/serializeCookie.test.js index 13e6d57ef..c07abf4d7 100644 --- a/test/serializeCookie/serializeCookie.test.js +++ b/test/serializeCookie/serializeCookie.test.js @@ -5,6 +5,8 @@ const serializeCookie = require('./serializeCookie.js'); test('serializeCookie is a Function', () => { expect(serializeCookie).toBeInstanceOf(Function); }); - t.equal(serializeCookie('foo', 'bar'), 'foo=bar', 'Serializes the cookie'); + test('Serializes the cookie', () => { + expect(serializeCookie('foo', 'bar'), 'foo=bar').toBe() +}); diff --git a/test/setStyle/setStyle.test.js b/test/setStyle/setStyle.test.js index 5dfb5ba7f..97214e8d4 100644 --- a/test/setStyle/setStyle.test.js +++ b/test/setStyle/setStyle.test.js @@ -5,6 +5,6 @@ const setStyle = require('./setStyle.js'); test('setStyle is a Function', () => { expect(setStyle).toBeInstanceOf(Function); }); - t.pass('Tested by @chalarangelo on 16/02/2018'); + diff --git a/test/shallowClone/shallowClone.test.js b/test/shallowClone/shallowClone.test.js index 5d0caaee8..d0806b0e3 100644 --- a/test/shallowClone/shallowClone.test.js +++ b/test/shallowClone/shallowClone.test.js @@ -8,6 +8,8 @@ const shallowClone = require('./shallowClone.js'); const a = { foo: 'bar', obj: { a: 1, b: 2 } }; const b = shallowClone(a); t.notEqual(a, b, 'Shallow cloning works'); - t.equal(a.obj, b.obj, 'Does not clone deeply'); + test('Does not clone deeply', () => { + expect(a.obj, b.obj).toBe() +}); diff --git a/test/show/show.test.js b/test/show/show.test.js index ae9f97f2e..92a94c1fd 100644 --- a/test/show/show.test.js +++ b/test/show/show.test.js @@ -5,6 +5,6 @@ const show = require('./show.js'); test('show is a Function', () => { expect(show).toBeInstanceOf(Function); }); - t.pass('Tested by @chalarangelo on 16/02/2018'); + diff --git a/test/shuffle/shuffle.test.js b/test/shuffle/shuffle.test.js index 7fa46495a..55914b5da 100644 --- a/test/shuffle/shuffle.test.js +++ b/test/shuffle/shuffle.test.js @@ -10,7 +10,11 @@ const shuffle = require('./shuffle.js'); test('New array contains all original elements', () => { expect(shuffle(arr).every(x => arr.includes(x))).toBeTruthy(); }); - t.deepEqual(shuffle([]),[],'Works for empty arrays'); - t.deepEqual(shuffle([1]),[1],'Works for single-element arrays'); + test('Works for empty arrays', () => { + expect(shuffle([]),[]).toEqual() +}); + test('Works for single-element arrays', () => { + expect(shuffle([1]),[1]).toEqual() +}); diff --git a/test/sleep/sleep.test.js b/test/sleep/sleep.test.js index af6aca5da..0996b476e 100644 --- a/test/sleep/sleep.test.js +++ b/test/sleep/sleep.test.js @@ -7,7 +7,7 @@ const sleep = require('./sleep.js'); }); async function sleepyWork() { await sleep(1000); - t.pass('Works as expected'); + } diff --git a/test/sortedIndexBy/sortedIndexBy.test.js b/test/sortedIndexBy/sortedIndexBy.test.js index 49d9d7d60..43972d8f8 100644 --- a/test/sortedIndexBy/sortedIndexBy.test.js +++ b/test/sortedIndexBy/sortedIndexBy.test.js @@ -5,6 +5,8 @@ const sortedIndexBy = require('./sortedIndexBy.js'); test('sortedIndexBy is a Function', () => { expect(sortedIndexBy).toBeInstanceOf(Function); }); - t.equal(sortedIndexBy([{ x: 4 }, { x: 5 }], { x: 4 }, o => o.x), 0, 'Returns the lowest index to insert the element without messing up the list order'); + test('Returns the lowest index to insert the element without messing up the list order', () => { + expect(sortedIndexBy([{ x: 4 }, { x: 5 }], { x: 4 }, o => o.x), 0).toBe() +}); diff --git a/test/sortedLastIndex/sortedLastIndex.test.js b/test/sortedLastIndex/sortedLastIndex.test.js index 4a502f50e..d1c4eced1 100644 --- a/test/sortedLastIndex/sortedLastIndex.test.js +++ b/test/sortedLastIndex/sortedLastIndex.test.js @@ -5,6 +5,8 @@ const sortedLastIndex = require('./sortedLastIndex.js'); test('sortedLastIndex is a Function', () => { expect(sortedLastIndex).toBeInstanceOf(Function); }); - t.equal(sortedLastIndex([10, 20, 30, 30, 40], 30), 4, 'Returns the highest index to insert the element without messing up the list order'); + test('Returns the highest index to insert the element without messing up the list order', () => { + expect(sortedLastIndex([10, 20, 30, 30, 40], 30), 4).toBe() +}); diff --git a/test/sortedLastIndexBy/sortedLastIndexBy.test.js b/test/sortedLastIndexBy/sortedLastIndexBy.test.js index 228e00249..9cdaebb51 100644 --- a/test/sortedLastIndexBy/sortedLastIndexBy.test.js +++ b/test/sortedLastIndexBy/sortedLastIndexBy.test.js @@ -5,6 +5,8 @@ const sortedLastIndexBy = require('./sortedLastIndexBy.js'); test('sortedLastIndexBy is a Function', () => { expect(sortedLastIndexBy).toBeInstanceOf(Function); }); - t.equal(sortedLastIndexBy([{ x: 4 }, { x: 5 }], { x: 4 }, o => o.x), 1, 'Returns the highest index to insert the element without messing up the list order'); + test('Returns the highest index to insert the element without messing up the list order', () => { + expect(sortedLastIndexBy([{ x: 4 }, { x: 5 }], { x: 4 }, o => o.x), 1).toBe() +}); diff --git a/test/stableSort/stableSort.test.js b/test/stableSort/stableSort.test.js index 2f54e14ee..975e08e45 100644 --- a/test/stableSort/stableSort.test.js +++ b/test/stableSort/stableSort.test.js @@ -8,6 +8,8 @@ const stableSort = require('./stableSort.js'); const arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; const compare = () => 0; - t.deepEqual(stableSort(arr, compare), arr, 'Array is properly sorted'); + test('Array is properly sorted', () => { + expect(stableSort(arr, compare), arr).toEqual() +}); diff --git a/test/symmetricDifferenceBy/symmetricDifferenceBy.test.js b/test/symmetricDifferenceBy/symmetricDifferenceBy.test.js index 43e69f13c..4c3e11107 100644 --- a/test/symmetricDifferenceBy/symmetricDifferenceBy.test.js +++ b/test/symmetricDifferenceBy/symmetricDifferenceBy.test.js @@ -5,6 +5,8 @@ const symmetricDifferenceBy = require('./symmetricDifferenceBy.js'); test('symmetricDifferenceBy is a Function', () => { expect(symmetricDifferenceBy).toBeInstanceOf(Function); }); - t.deepEqual(symmetricDifferenceBy([2.1, 1.2], [2.3, 3.4], Math.floor), [ 1.2, 3.4 ], 'Returns the symmetric difference between two arrays, after applying the provided function to each array element of both'); + test('Returns the symmetric difference between two arrays, after applying the provided function to each array element of both', () => { + expect(symmetricDifferenceBy([2.1, 1.2], [2.3, 3.4], Math.floor), [ 1.2, 3.4 ]).toEqual() +}); diff --git a/test/takeRightWhile/takeRightWhile.test.js b/test/takeRightWhile/takeRightWhile.test.js index d300b3651..91bdd6917 100644 --- a/test/takeRightWhile/takeRightWhile.test.js +++ b/test/takeRightWhile/takeRightWhile.test.js @@ -5,6 +5,8 @@ const takeRightWhile = require('./takeRightWhile.js'); test('takeRightWhile is a Function', () => { expect(takeRightWhile).toBeInstanceOf(Function); }); - t.deepEqual(takeRightWhile([1, 2, 3, 4], n => n < 3), [3, 4], 'Removes elements until the function returns true'); + test('Removes elements until the function returns true', () => { + expect(takeRightWhile([1, 2, 3, 4], n => n < 3), [3, 4]).toEqual() +}); diff --git a/test/takeWhile/takeWhile.test.js b/test/takeWhile/takeWhile.test.js index a8949edf4..0a105b25b 100644 --- a/test/takeWhile/takeWhile.test.js +++ b/test/takeWhile/takeWhile.test.js @@ -5,6 +5,8 @@ const takeWhile = require('./takeWhile.js'); test('takeWhile is a Function', () => { expect(takeWhile).toBeInstanceOf(Function); }); - t.deepEqual(takeWhile([1, 2, 3, 4], n => n >= 3), [1, 2], 'Removes elements until the function returns true'); + test('Removes elements until the function returns true', () => { + expect(takeWhile([1, 2, 3, 4], n => n >= 3), [1, 2]).toEqual() +}); diff --git a/test/throttle/throttle.test.js b/test/throttle/throttle.test.js index 5e3436417..31cf950fe 100644 --- a/test/throttle/throttle.test.js +++ b/test/throttle/throttle.test.js @@ -5,6 +5,6 @@ const throttle = require('./throttle.js'); test('throttle is a Function', () => { expect(throttle).toBeInstanceOf(Function); }); - t.pass('Tested by @chalarangelo on 16/02/2018'); + diff --git a/test/timeTaken/timeTaken.test.js b/test/timeTaken/timeTaken.test.js index 58755e045..3782a78ee 100644 --- a/test/timeTaken/timeTaken.test.js +++ b/test/timeTaken/timeTaken.test.js @@ -5,6 +5,6 @@ const timeTaken = require('./timeTaken.js'); test('timeTaken is a Function', () => { expect(timeTaken).toBeInstanceOf(Function); }); - t.pass('Tested by @chalarangelo on 16/02/2018'); + diff --git a/test/toCurrency/toCurrency.test.js b/test/toCurrency/toCurrency.test.js index b06368eb9..c429efcfc 100644 --- a/test/toCurrency/toCurrency.test.js +++ b/test/toCurrency/toCurrency.test.js @@ -5,8 +5,14 @@ const toCurrency = require('./toCurrency.js'); test('toCurrency is a Function', () => { expect(toCurrency).toBeInstanceOf(Function); }); - t.equal(toCurrency(123456.789, 'EUR'), '€ 123,456.79', 'currency: Euro | currencyLangFormat: Local'); - t.equal(toCurrency(123456.789, 'USD', 'en-us'), '$123,456.79', ' currency: US Dollar | currencyLangFormat: English (United States)'); - t.equal(toCurrency(322342436423.2435, 'JPY'), 'JP„ 322,342,436,423', 'currency: Japanese Yen | currencyLangFormat: Local'); + test('currency: Euro | currencyLangFormat: Local', () => { + expect(toCurrency(123456.789, 'EUR'), '€ 123,456.79').toBe() +}); + test(' currency: US Dollar | currencyLangFormat: English (United States)', () => { + expect(toCurrency(123456.789, 'USD', 'en-us'), '$123,456.79').toBe() +}); + test('currency: Japanese Yen | currencyLangFormat: Local', () => { + expect(toCurrency(322342436423.2435, 'JPY'), 'JP„ 322,342,436,423').toBe() +}); diff --git a/test/toKebabCase/toKebabCase.test.js b/test/toKebabCase/toKebabCase.test.js index 8773f6228..32e9d81d6 100644 --- a/test/toKebabCase/toKebabCase.test.js +++ b/test/toKebabCase/toKebabCase.test.js @@ -9,7 +9,9 @@ const toKebabCase = require('./toKebabCase.js'); t.equal(toKebabCase('some text'), 'some-text', "toKebabCase('some text') returns some-text"); t.equal(toKebabCase('some-mixed-string With spaces-underscores-and-hyphens'), 'some-mixed-string-with-spaces-underscores-and-hyphens', "toKebabCase('some-mixed-string With spaces-underscores-and-hyphens') returns some-mixed-string-with-spaces-underscores-and-hyphens"); t.equal(toKebabCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML'), 'i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html', "toKebabCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML') returns i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html"); - t.equal(toKebabCase(), undefined, 'toKebabCase() return undefined'); + test('toKebabCase() return undefined', () => { + expect(toKebabCase(), undefined).toBe() +}); t.throws(() => toKebabCase([]), 'toKebabCase([]) throws an error'); t.throws(() => toKebabCase({}), 'toKebabCase({}) throws an error'); t.throws(() => toKebabCase(123), 'toKebabCase(123) throws an error'); diff --git a/test/toOrdinalSuffix/toOrdinalSuffix.test.js b/test/toOrdinalSuffix/toOrdinalSuffix.test.js index 6d6fc41eb..523191f58 100644 --- a/test/toOrdinalSuffix/toOrdinalSuffix.test.js +++ b/test/toOrdinalSuffix/toOrdinalSuffix.test.js @@ -5,8 +5,16 @@ const toOrdinalSuffix = require('./toOrdinalSuffix.js'); test('toOrdinalSuffix is a Function', () => { expect(toOrdinalSuffix).toBeInstanceOf(Function); }); - t.equal(toOrdinalSuffix('123'), '123rd', 'Adds an ordinal suffix to a number'); - t.equal(toOrdinalSuffix(5), '5th', 'Adds an ordinal suffix to a number'); - t.equal(toOrdinalSuffix(1), '1st', 'Adds an ordinal suffix to a number'); - t.equal(toOrdinalSuffix(0), '0th', 'Adds an ordinal suffix to a number'); + test('Adds an ordinal suffix to a number', () => { + expect(toOrdinalSuffix('123'), '123rd').toBe() +}); + test('Adds an ordinal suffix to a number', () => { + expect(toOrdinalSuffix(5), '5th').toBe() +}); + test('Adds an ordinal suffix to a number', () => { + expect(toOrdinalSuffix(1), '1st').toBe() +}); + test('Adds an ordinal suffix to a number', () => { + expect(toOrdinalSuffix(0), '0th').toBe() +}); diff --git a/test/toSnakeCase/toSnakeCase.test.js b/test/toSnakeCase/toSnakeCase.test.js index bf472bbae..89ad48fe6 100644 --- a/test/toSnakeCase/toSnakeCase.test.js +++ b/test/toSnakeCase/toSnakeCase.test.js @@ -9,7 +9,9 @@ const toSnakeCase = require('./toSnakeCase.js'); t.equal(toSnakeCase('some text'), 'some_text', "toSnakeCase('some text') returns some_text"); t.equal(toSnakeCase('some-mixed_string With spaces_underscores-and-hyphens'), 'some_mixed_string_with_spaces_underscores_and_hyphens', "toSnakeCase('some-mixed_string With spaces_underscores-and-hyphens') returns some_mixed_string_with_spaces_underscores_and_hyphens"); t.equal(toSnakeCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML'), 'i_am_listening_to_fm_while_loading_different_url_on_my_browser_and_also_editing_some_xml_and_html', "toSnakeCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML') returns i_am_listening_to_fm_while_loading_different_url_on_my_browser_and_also_editing_some_xml_and_html"); - t.equal(toSnakeCase(), undefined, 'toSnakeCase() returns undefined'); + test('toSnakeCase() returns undefined', () => { + expect(toSnakeCase(), undefined).toBe() +}); t.throws(() => toSnakeCase([]), 'toSnakeCase([]) throws an error'); t.throws(() => toSnakeCase({}), 'toSnakeCase({}) throws an error'); t.throws(() => toSnakeCase(123), 'toSnakeCase(123) throws an error'); diff --git a/test/toggleClass/toggleClass.test.js b/test/toggleClass/toggleClass.test.js index 3a4d104ad..82a15fff7 100644 --- a/test/toggleClass/toggleClass.test.js +++ b/test/toggleClass/toggleClass.test.js @@ -5,6 +5,6 @@ const toggleClass = require('./toggleClass.js'); test('toggleClass is a Function', () => { expect(toggleClass).toBeInstanceOf(Function); }); - t.pass('Tested by @chalarangelo on 16/02/2018'); + diff --git a/test/tomorrow/tomorrow.test.js b/test/tomorrow/tomorrow.test.js index 490e42f42..fc516576d 100644 --- a/test/tomorrow/tomorrow.test.js +++ b/test/tomorrow/tomorrow.test.js @@ -7,8 +7,14 @@ const tomorrow = require('./tomorrow.js'); }); const t1 = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() + 1); const t2 = new Date(tomorrow()); - t.equal(t1.getFullYear(), t2.getFullYear(), 'Returns the correct year'); - t.equal(t1.getMonth(), t2.getMonth(), 'Returns the correct month'); - t.equal(t1.getDate(), t2.getDate(), 'Returns the correct date'); + test('Returns the correct year', () => { + expect(t1.getFullYear(), t2.getFullYear()).toBe() +}); + test('Returns the correct month', () => { + expect(t1.getMonth(), t2.getMonth()).toBe() +}); + test('Returns the correct date', () => { + expect(t1.getDate(), t2.getDate()).toBe() +}); diff --git a/test/truncateString/truncateString.test.js b/test/truncateString/truncateString.test.js index cfebd7f9a..c3ec9db4e 100644 --- a/test/truncateString/truncateString.test.js +++ b/test/truncateString/truncateString.test.js @@ -5,5 +5,7 @@ const truncateString = require('./truncateString.js'); test('truncateString is a Function', () => { expect(truncateString).toBeInstanceOf(Function); }); - t.equal(truncateString('boomerang', 7), 'boom...', 'Truncates a "boomerang" up to a specified length.'); + test('Truncates a "boomerang" up to a specified length.', () => { + expect(truncateString('boomerang', 7), 'boom...').toBe() +}); diff --git a/test/unary/unary.test.js b/test/unary/unary.test.js index c559cbeaa..0dc3ee657 100644 --- a/test/unary/unary.test.js +++ b/test/unary/unary.test.js @@ -5,6 +5,8 @@ const unary = require('./unary.js'); test('unary is a Function', () => { expect(unary).toBeInstanceOf(Function); }); - t.deepEqual(['6', '8', '10'].map(unary(parseInt)), [6, 8, 10], 'Discards arguments after the first one'); + test('Discards arguments after the first one', () => { + expect(['6', '8', '10'].map(unary(parseInt)), [6, 8, 10]).toEqual() +}); diff --git a/test/uncurry/uncurry.test.js b/test/uncurry/uncurry.test.js index 57da1c13b..d9e39c581 100644 --- a/test/uncurry/uncurry.test.js +++ b/test/uncurry/uncurry.test.js @@ -9,8 +9,14 @@ const uncurry = require('./uncurry.js'); const add1 = uncurry(add); const add2 = uncurry(add, 2); const add3 = uncurry(add, 3); - t.equal(add1(1)(2)(3), 6, 'Works without a provided value for n'); - t.equal(add2(1,2)(3), 6, 'Works without n = 2'); - t.equal(add3(1,2,3), 6, 'Works withoutn = 3'); + test('Works without a provided value for n', () => { + expect(add1(1)(2)(3), 6).toBe() +}); + test('Works without n = 2', () => { + expect(add2(1,2)(3), 6).toBe() +}); + test('Works withoutn = 3', () => { + expect(add3(1,2,3), 6).toBe() +}); diff --git a/test/unescapeHTML/unescapeHTML.test.js b/test/unescapeHTML/unescapeHTML.test.js index a45df3621..0521796c2 100644 --- a/test/unescapeHTML/unescapeHTML.test.js +++ b/test/unescapeHTML/unescapeHTML.test.js @@ -5,5 +5,7 @@ const unescapeHTML = require('./unescapeHTML.js'); test('unescapeHTML is a Function', () => { expect(unescapeHTML).toBeInstanceOf(Function); }); - t.equal(unescapeHTML('<a href="#">Me & you</a>'), 'Me & you', 'Unescapes escaped HTML characters.'); + test('Unescapes escaped HTML characters.', () => { + expect(unescapeHTML('<a href="#">Me & you</a>'), 'Me & you').toBe() +}); diff --git a/test/unflattenObject/unflattenObject.test.js b/test/unflattenObject/unflattenObject.test.js index 67b763ff1..55fa668b9 100644 --- a/test/unflattenObject/unflattenObject.test.js +++ b/test/unflattenObject/unflattenObject.test.js @@ -5,6 +5,8 @@ const unflattenObject = require('./unflattenObject.js'); test('unflattenObject is a Function', () => { expect(unflattenObject).toBeInstanceOf(Function); }); - t.deepEqual(unflattenObject({ 'a.b.c': 1, d: 1 }), { a: { b: { c: 1 } }, d: 1 }, 'Unflattens an object with the paths for keys'); + test('Unflattens an object with the paths for keys', () => { + expect(unflattenObject({ 'a.b.c': 1, d: 1 }), { a: { b: { c: 1 } }, d: 1 }).toEqual() +}); diff --git a/test/unfold/unfold.test.js b/test/unfold/unfold.test.js index 1a053f9e4..ee36c7572 100644 --- a/test/unfold/unfold.test.js +++ b/test/unfold/unfold.test.js @@ -6,6 +6,8 @@ const unfold = require('./unfold.js'); expect(unfold).toBeInstanceOf(Function); }); var f = n => (n > 50 ? false : [-n, n + 10]); - t.deepEqual(unfold(f, 10), [-10, -20, -30, -40, -50], 'Works with a given function, producing an array'); + test('Works with a given function, producing an array', () => { + expect(unfold(f, 10), [-10, -20, -30, -40, -50]).toEqual() +}); diff --git a/test/unionBy/unionBy.test.js b/test/unionBy/unionBy.test.js index a9010b62e..95c5c870e 100644 --- a/test/unionBy/unionBy.test.js +++ b/test/unionBy/unionBy.test.js @@ -5,6 +5,8 @@ const unionBy = require('./unionBy.js'); test('unionBy is a Function', () => { expect(unionBy).toBeInstanceOf(Function); }); - t.deepEqual(unionBy([2.1], [1.2, 2.3], Math.floor), [2.1, 1.2], 'Produces the appropriate results'); + test('Produces the appropriate results', () => { + expect(unionBy([2.1], [1.2, 2.3], Math.floor), [2.1, 1.2]).toEqual() +}); diff --git a/test/unionWith/unionWith.test.js b/test/unionWith/unionWith.test.js index 4a299689e..c4c0d44cc 100644 --- a/test/unionWith/unionWith.test.js +++ b/test/unionWith/unionWith.test.js @@ -5,6 +5,8 @@ const unionWith = require('./unionWith.js'); test('unionWith is a Function', () => { expect(unionWith).toBeInstanceOf(Function); }); - t.deepEqual(unionWith([1, 1.2, 1.5, 3, 0], [1.9, 3, 0, 3.9], (a, b) => Math.round(a) === Math.round(b)), [1, 1.2, 1.5, 3, 0, 3.9], 'Produces the appropriate results'); + 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)), [1, 1.2, 1.5, 3, 0, 3.9]).toEqual() +}); diff --git a/test/untildify/untildify.test.js b/test/untildify/untildify.test.js index 80075903b..f020ade98 100644 --- a/test/untildify/untildify.test.js +++ b/test/untildify/untildify.test.js @@ -8,7 +8,11 @@ const untildify = require('./untildify.js'); test('Contains no tildes', () => { expect(untildify('~/test/dir/file.f').indexOf('~') === -1).toBeTruthy(); }); - t.equal(untildify('~/test/dir/file.f').slice(-16), '/test/dir/file.f', 'Does not alter the rest of the path'); - t.equal(untildify('test/dir/file.f'), 'test/dir/file.f', 'Does not alter paths without tildes'); + test('Does not alter the rest of the path', () => { + expect(untildify('~/test/dir/file.f').slice(-16), '/test/dir/file.f').toBe() +}); + test('Does not alter paths without tildes', () => { + expect(untildify('test/dir/file.f'), 'test/dir/file.f').toBe() +}); diff --git a/test/zip/zip.test.js b/test/zip/zip.test.js index a0b075e87..f6af12c43 100644 --- a/test/zip/zip.test.js +++ b/test/zip/zip.test.js @@ -5,10 +5,18 @@ const zip = require('./zip.js'); test('zip is a Function', () => { expect(zip).toBeInstanceOf(Function); }); - t.deepEqual(zip(['a', 'b'], [1, 2], [true, false]), [['a', 1, true], ['b', 2, false]], 'zip([a, b], [1, 2], [true, false]) returns [[a, 1, true], [b, 2, false]]'); - t.deepEqual(zip(['a'], [1, 2], [true, false]), [['a', 1, true], [undefined, 2, false]], 'zip([a], [1, 2], [true, false]) returns [[a, 1, true], [undefined, 2, false]]'); - t.deepEqual(zip(), [], 'zip([]) returns []'); - t.deepEqual(zip(123), [], 'zip(123) returns []'); + test('zip([a, b], [1, 2], [true, false]) returns [[a, 1, true], [b, 2, false]]', () => { + expect(zip(['a', 'b'], [1, 2], [true, false]), [['a', 1, true], ['b', 2, false]]).toEqual() +}); + test('zip([a], [1, 2], [true, false]) returns [[a, 1, true], [undefined, 2, false]]', () => { + expect(zip(['a'], [1, 2], [true, false]), [['a', 1, true], [undefined, 2, false]]).toEqual() +}); + test('zip([]) returns []', () => { + expect(zip(), []).toEqual() +}); + test('zip(123) returns []', () => { + expect(zip(123), []).toEqual() +}); test('zip([a, b], [1, 2], [true, false]) returns an Array', () => { expect(Array.isArray(zip(['a', 'b'], [1, 2], [true, false]))).toBeTruthy(); }); diff --git a/test/zipObject/zipObject.test.js b/test/zipObject/zipObject.test.js index c703b3f68..b0a2b4b76 100644 --- a/test/zipObject/zipObject.test.js +++ b/test/zipObject/zipObject.test.js @@ -5,10 +5,18 @@ const zipObject = require('./zipObject.js'); test('zipObject is a Function', () => { expect(zipObject).toBeInstanceOf(Function); }); - t.deepEqual(zipObject(['a', 'b', 'c'], [1, 2]), {a: 1, b: 2, c: undefined}, 'zipObject([a, b, c], [1, 2]) returns {a: 1, b: 2, c: undefined}'); - t.deepEqual(zipObject(['a', 'b'], [1, 2, 3]), {a: 1, b: 2}, 'zipObject([a, b], [1, 2, 3]) returns {a: 1, b: 2}'); - t.deepEqual(zipObject(['a', 'b', 'c'], 'string'), { a: 's', b: 't', c: 'r' }, 'zipObject([a, b, c], string) returns { a: s, b: t, c: r }'); - t.deepEqual(zipObject(['a'], 'string'), { a: 's' }, 'zipObject([a], string) returns { a: s }'); + test('zipObject([a, b, c], [1, 2]) returns {a: 1, b: 2, c: undefined}', () => { + expect(zipObject(['a', 'b', 'c'], [1, 2]), {a: 1, b: 2, c: undefined}).toEqual() +}); + test('zipObject([a, b], [1, 2, 3]) returns {a: 1, b: 2}', () => { + expect(zipObject(['a', 'b'], [1, 2, 3]), {a: 1, b: 2}).toEqual() +}); + test('zipObject([a, b, c], string) returns { a: s, b: t, c: r }', () => { + expect(zipObject(['a', 'b', 'c'], 'string'), { a: 's', b: 't', c: 'r' }).toEqual() +}); + test('zipObject([a], string) returns { a: s }', () => { + expect(zipObject(['a'], 'string'), { a: 's' }).toEqual() +}); t.throws(() => zipObject(), 'zipObject() throws an error'); t.throws(() => zipObject(['string'], null), 'zipObject([string], null) throws an error'); t.throws(() => zipObject(null, [1]), 'zipObject(null, [1]) throws an error');