diff --git a/test/RGBToHex/RGBToHex.test.js b/test/RGBToHex/RGBToHex.test.js
index e290b6bb5..f4bf6d773 100644
--- a/test/RGBToHex/RGBToHex.test.js
+++ b/test/RGBToHex/RGBToHex.test.js
@@ -5,5 +5,7 @@ const RGBToHex = require('./RGBToHex.js');
test('RGBToHex is a Function', () => {
expect(RGBToHex).toBeInstanceOf(Function);
});
- t.equal(RGBToHex(255, 165, 1), 'ffa501', "Converts the values of RGB components to a color code.");
+ test('Converts the values of RGB components to a color code.', () => {
+ expect(RGBToHex(255, 165, 1)).toBe('ffa501')
+});
diff --git a/test/call/call.test.js b/test/call/call.test.js
index a4585ac22..d445ab45f 100644
--- a/test/call/call.test.js
+++ b/test/call/call.test.js
@@ -1,9 +1,9 @@
const expect = require('expect');
const call = require('./call.js');
-
- test('call is a Function', () => {
+test('call is a Function', () => {
expect(call).toBeInstanceOf(Function);
});
- t.looseEqual(call('map', x => x * 2)([1, 2, 3]), [2, 4, 6], 'Calls function on given object');
-
+test('Calls function on given object', () => {
+ expect(call('map', x => x * 2)([1, 2, 3])).toBe([2, 4, 6]);
+});
diff --git a/test/capitalize/capitalize.test.js b/test/capitalize/capitalize.test.js
index c031fedf2..6fb4a1bd8 100644
--- a/test/capitalize/capitalize.test.js
+++ b/test/capitalize/capitalize.test.js
@@ -1,12 +1,18 @@
const expect = require('expect');
const capitalize = require('./capitalize.js');
-
- test('capitalize is a Function', () => {
+test('capitalize is a Function', () => {
expect(capitalize).toBeInstanceOf(Function);
});
- t.equal(capitalize('fooBar'), 'FooBar', "Capitalizes the first letter of a string");
- t.equal(capitalize('fooBar', true), 'Foobar', "Capitalizes the first letter of a string");
- t.equal(capitalize('#!#', true), '#!#', "Works with characters");
- t.equal(capitalize('a', true), 'A', "Works with single character words");
-
+test('Capitalizes the first letter of a string', () => {
+ expect(capitalize('fooBar')).toBe('FooBar');
+});
+test('Capitalizes the first letter of a string', () => {
+ expect(capitalize('fooBar', true)).toBe('FooBar');
+});
+test('Works with characters', () => {
+ expect(capitalize('#!#', true)).toBe('#!#');
+});
+test('"Works with single character words', () => {
+ expect(capitalize('a', true)).toBe('A');
+});
diff --git a/test/capitalizeEveryWord/capitalizeEveryWord.test.js b/test/capitalizeEveryWord/capitalizeEveryWord.test.js
index 7da925b9a..39a025b0b 100644
--- a/test/capitalizeEveryWord/capitalizeEveryWord.test.js
+++ b/test/capitalizeEveryWord/capitalizeEveryWord.test.js
@@ -1,11 +1,15 @@
const expect = require('expect');
const capitalizeEveryWord = require('./capitalizeEveryWord.js');
-
- test('capitalizeEveryWord is a Function', () => {
+test('capitalizeEveryWord is a Function', () => {
expect(capitalizeEveryWord).toBeInstanceOf(Function);
});
- t.equal(capitalizeEveryWord('hello world!'), 'Hello World!', "Capitalizes the first letter of every word in a string");
- t.equal(capitalizeEveryWord('$# @!'), '$# @!', "Works with characters");
- t.equal(capitalizeEveryWord('a'), 'A', "Works with one word string");
-
+test('Capitalizes the first letter of every word in a string', () => {
+ expect(capitalizeEveryWord('hello world!'), 'Hello World!').toBe();
+});
+test('Works with characters', () => {
+ expect(capitalizeEveryWord('$# @!')).toBe('$# @!');
+});
+test('Works with one word string', () => {
+ expect(capitalizeEveryWord('a')).toBe('A');
+});
diff --git a/test/castArray/castArray.test.js b/test/castArray/castArray.test.js
index f3883879a..f1c594a70 100644
--- a/test/castArray/castArray.test.js
+++ b/test/castArray/castArray.test.js
@@ -1,24 +1,21 @@
const expect = require('expect');
const castArray = require('./castArray.js');
-
- test('castArray is a Function', () => {
+test('castArray is a Function', () => {
expect(castArray).toBeInstanceOf(Function);
});
- test('Works for single values', () => {
- expect(castArray(1), [1]).toEqual()
+test('Works for single values', () => {
+ expect(castArray(1)).toEqual([1]);
});
- test('Works for arrays with one value', () => {
- expect(castArray([1]), [1]).toEqual()
+test('Works for arrays with one value', () => {
+ expect(castArray([1])).toEqual([1]);
});
- test('Works for arrays with multiple value', () => {
- expect(castArray([1,2,3]), [1,2,3]).toEqual()
+test('Works for arrays with multiple value', () => {
+ expect(castArray([1,2,3])).toEqual( [1,2,3]);
});
- test('Works for strings', () => {
- expect(castArray('test'), ['test']).toEqual()
+test('Works for strings', () => {
+ expect(castArray('test')).toEqual(['test'])
});
- test('Works for objects', () => {
- expect(castArray({}), [{}]).toEqual()
+test('Works for objects', () => {
+ expect(castArray({})).toEqual([{}])
});
-
-
diff --git a/test/chainAsync/chainAsync.test.js b/test/chainAsync/chainAsync.test.js
index 8e90219ef..9d69ef316 100644
--- a/test/chainAsync/chainAsync.test.js
+++ b/test/chainAsync/chainAsync.test.js
@@ -1,10 +1,11 @@
const expect = require('expect');
const chainAsync = require('./chainAsync.js');
-
- test('chainAsync is a Function', () => {
+test('chainAsync is a Function', () => {
expect(chainAsync).toBeInstanceOf(Function);
});
+
+test('Calls all functions in an array', () => {
chainAsync([
next => {
next();
@@ -15,8 +16,7 @@ const chainAsync = require('./chainAsync.js');
})();
},
next => {
-
+ expect(true).toBeTruthy();
}
]);
-
-
+});
diff --git a/test/chunk/chunk.test.js b/test/chunk/chunk.test.js
index f257adac8..212ef3c79 100644
--- a/test/chunk/chunk.test.js
+++ b/test/chunk/chunk.test.js
@@ -1,32 +1,36 @@
const expect = require('expect');
const chunk = require('./chunk.js');
-
- test('chunk is a Function', () => {
+test('chunk is a Function', () => {
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]] ");
- test('chunk([]) returns []', () => {
- expect(chunk([]), []).toEqual()
+test('chunk([1, 2, 3, 4, 5], 2) returns [[1,2],[3,4],[5]] ', () => {
+ expect(chunk([1, 2, 3, 4, 5], 2)).toEqual([[1,2],[3,4][5]]);
});
- test('chunk(123) returns []', () => {
- expect(chunk(123), []).toEqual()
+test('chunk([]) returns []', () => {
+ expect(chunk([])).toEqual([])
});
- test('chunk({ a: 123}) returns []', () => {
- expect(chunk({ a: 123}), []).toEqual()
+test('chunk(123) returns []', () => {
+ expect(chunk(123)).toEqual([])
});
- test('chunk(string, 2) returns [ st, ri, ng ]', () => {
- expect(chunk('string', 2), [ 'st', 'ri', 'ng' ]).toEqual()
+test('chunk({ a: 123}) returns []', () => {
+ expect(chunk({ a: 123})).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');
-
- let start = new Date().getTime();
- chunk('This is a string', 2);
- let end = new Date().getTime();
- test('chunk(This is a string, 2) takes less than 2s to run', () => {
+test('chunk(string, 2) returns [ st, ri, ng ]', () => {
+ expect(chunk('string', 2)).toEqual( [ 'st', 'ri', 'ng' ])
+});
+test('chunk() throws an error', () => {
+ expect(chunk()).toThrow();
+});
+test('chunk(undefined) throws an error', () => {
+ expect(chunk(undefined)).toThrow();
+});
+test('chunk(null) throws an error', () => {
+ expect(chunk(null)).toThrow();
+});
+let start = new Date().getTime();
+chunk('This is a string', 2);
+let end = new Date().getTime();
+test('chunk(This is a string, 2) takes less than 2s to run', () => {
expect((end - start) < 2000).toBeTruthy();
});
-
-
diff --git a/test/clampNumber/clampNumber.test.js b/test/clampNumber/clampNumber.test.js
index 9d4cd64b3..9e9d406b6 100644
--- a/test/clampNumber/clampNumber.test.js
+++ b/test/clampNumber/clampNumber.test.js
@@ -1,9 +1,9 @@
const expect = require('expect');
const clampNumber = require('./clampNumber.js');
-
- test('clampNumber is a Function', () => {
+test('clampNumber is a Function', () => {
expect(clampNumber).toBeInstanceOf(Function);
});
- t.equal(clampNumber(2, 3, 5), 3, "Clamps num within the inclusive range specified by the boundary values a and b");
-
+test('Clamps num within the inclusive range specified by the boundary values a and b', () => {
+ expect(clampNumber(2, 3, 5)).toBe(3)
+});
diff --git a/test/cleanObj/cleanObj.test.js b/test/cleanObj/cleanObj.test.js
index 916281b31..9e221f468 100644
--- a/test/cleanObj/cleanObj.test.js
+++ b/test/cleanObj/cleanObj.test.js
@@ -1,10 +1,10 @@
const expect = require('expect');
const cleanObj = require('./cleanObj.js');
-
- test('cleanObj is a Function', () => {
+test('cleanObj is a Function', () => {
expect(cleanObj).toBeInstanceOf(Function);
});
- const testObj = { a: 1, b: 2, children: { a: 1, b: 2 } };
- t.deepEqual(cleanObj(testObj, ['a'], 'children'), { a: 1, children : { a: 1}}, "Removes any properties except the ones specified from a JSON object");
-
+const testObj = { a: 1, b: 2, children: { a: 1, b: 2 } };
+test('Removes any properties except the ones specified from a JSON object', () => {
+ expect(cleanObj(testObj, ['a'], 'children')).toEqual({ a: 1, children : { a: 1}});
+});
diff --git a/test/cloneRegExp/cloneRegExp.test.js b/test/cloneRegExp/cloneRegExp.test.js
index 8f6e675c9..e4469ec39 100644
--- a/test/cloneRegExp/cloneRegExp.test.js
+++ b/test/cloneRegExp/cloneRegExp.test.js
@@ -1,11 +1,10 @@
const expect = require('expect');
const cloneRegExp = require('./cloneRegExp.js');
-
- test('cloneRegExp is a Function', () => {
+test('cloneRegExp is a Function', () => {
expect(cloneRegExp).toBeInstanceOf(Function);
});
- const rgTest = /./g;
- t.notEqual(cloneRegExp(rgTest), rgTest, 'Clones regular expressions properly');
-
-
+const rgTest = /./g;
+test('Clones regular expressions properly', () => {
+ expect(cloneRegExp(rgTest).not.toEqual(rgTest);
+});
diff --git a/test/coalesce/coalesce.test.js b/test/coalesce/coalesce.test.js
index aacedc163..5481b85db 100644
--- a/test/coalesce/coalesce.test.js
+++ b/test/coalesce/coalesce.test.js
@@ -1,9 +1,9 @@
const expect = require('expect');
const coalesce = require('./coalesce.js');
-
- test('coalesce is a Function', () => {
+test('coalesce is a Function', () => {
expect(coalesce).toBeInstanceOf(Function);
});
- t.deepEqual(coalesce(null, undefined, '', NaN, 'Waldo'), '', "Returns the first non-null/undefined argument");
-
+test('Returns the first non-null/undefined argument', () => {
+ expect(coalesce(null, undefined, '', NaN, 'Waldo')).toEqual('')
+});
diff --git a/test/coalesceFactory/coalesceFactory.test.js b/test/coalesceFactory/coalesceFactory.test.js
index f6645b692..609ac9b5d 100644
--- a/test/coalesceFactory/coalesceFactory.test.js
+++ b/test/coalesceFactory/coalesceFactory.test.js
@@ -1,10 +1,10 @@
const expect = require('expect');
const coalesceFactory = require('./coalesceFactory.js');
-
- test('coalesceFactory is a Function', () => {
+test('coalesceFactory is a Function', () => {
expect(coalesceFactory).toBeInstanceOf(Function);
});
- const customCoalesce = coalesceFactory(_ => ![null, undefined, '', NaN].includes(_));
- t.deepEqual(customCoalesce(undefined, null, NaN, '', 'Waldo'), 'Waldo', "Returns a customized coalesce function");
-
+const customCoalesce = coalesceFactory(_ => ![null, undefined, '', NaN].includes(_));
+test('Returns a customized coalesce function', () => {
+ expect(customCoalesce(undefined, null, NaN, '', 'Waldo')).toEqual('Waldo')
+});
diff --git a/test/collatz/collatz.test.js b/test/collatz/collatz.test.js
index 9598acaa9..a4bfa2125 100644
--- a/test/collatz/collatz.test.js
+++ b/test/collatz/collatz.test.js
@@ -1,24 +1,22 @@
const expect = require('expect');
const collatz = require('./collatz.js');
-
- test('collatz is a Function', () => {
+test('collatz is a Function', () => {
expect(collatz).toBeInstanceOf(Function);
});
- test('When n is even, divide by 2', () => {
- expect(collatz(8), 4).toBe()
+test('When n is even, divide by 2', () => {
+ expect(collatz(8)).toBe(4);
});
- test('When n is odd, times by 3 and add 1', () => {
- expect(collatz(9), 28).toBe()
+test('When n is odd, times by 3 and add 1', () => {
+ expect(collatz(9)).toBe(28);
});
-
+test('Eventually reaches 1', () => {
let n = 9;
while(true){
if (n === 1){
-
+ expect(n).toBe(1);
break;
}
n = collatz(n);
}
-
-
+});
diff --git a/test/collectInto/collectInto.test.js b/test/collectInto/collectInto.test.js
index e2a073af8..78b34607f 100644
--- a/test/collectInto/collectInto.test.js
+++ b/test/collectInto/collectInto.test.js
@@ -1,16 +1,13 @@
const expect = require('expect');
const collectInto = require('./collectInto.js');
-
- test('collectInto is a Function', () => {
+test('collectInto is a Function', () => {
expect(collectInto).toBeInstanceOf(Function);
});
- const Pall = collectInto(Promise.all.bind(Promise));
- 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){ test('Works with multiple promises', () => {
- expect(val, [1,2,3]).toEqual()
-});}, function(reason){
-
-
+const Pall = collectInto(Promise.all.bind(Promise));
+let p1 = Promise.resolve(1);
+let p2 = Promise.resolve(2);
+let p3 = new Promise(resolve => setTimeout(resolve, 2000, 3));
+test('Works with multiple promises', () => {
+ Pall(p1, p2, p3).then(function(val){ expect(val).toBe([1,2,3]);}, function(reason){});
+});
diff --git a/test/colorize/colorize.test.js b/test/colorize/colorize.test.js
index 10950ab7f..73658ae79 100644
--- a/test/colorize/colorize.test.js
+++ b/test/colorize/colorize.test.js
@@ -1,10 +1,6 @@
const expect = require('expect');
const colorize = require('./colorize.js');
-
- test('colorize is a Function', () => {
+test('colorize is a Function', () => {
expect(colorize).toBeInstanceOf(Function);
});
-
-
-
diff --git a/test/compact/compact.test.js b/test/compact/compact.test.js
index 087340a4c..5fe0ee12e 100644
--- a/test/compact/compact.test.js
+++ b/test/compact/compact.test.js
@@ -1,9 +1,9 @@
const expect = require('expect');
const compact = require('./compact.js');
-
- test('compact is a Function', () => {
+test('compact is a Function', () => {
expect(compact).toBeInstanceOf(Function);
});
- t.deepEqual(compact([0, 1, false, 2, '', 3, 'a', 'e' * 23, NaN, 's', 34]), [ 1, 2, 3, 'a', 's', 34 ], "Removes falsey values from an array");
-
+test('Removes falsey values from an array', () => {
+ expect(compact([0, 1, false, 2, '', 3, 'a', 'e' * 23, NaN, 's', 34])).toEqual([ 1, 2, 3, 'a', 's', 34 ]);
+});
diff --git a/test/compose/compose.test.js b/test/compose/compose.test.js
index b5332a0be..5da32630f 100644
--- a/test/compose/compose.test.js
+++ b/test/compose/compose.test.js
@@ -1,12 +1,12 @@
const expect = require('expect');
const compose = require('./compose.js');
-
- test('compose is a Function', () => {
+test('compose is a Function', () => {
expect(compose).toBeInstanceOf(Function);
});
- const add5 = x => x + 5;
- const multiply = (x, y) => x * y;
- const multiplyAndAdd5 = compose(add5, multiply);
- t.equal(multiplyAndAdd5(5, 2), 15, "Performs right-to-left function composition");
-
+const add5 = x => x + 5;
+const multiply = (x, y) => x * y;
+const multiplyAndAdd5 = compose(add5, multiply);
+test('Performs right-to-left function composition', () => {
+ expect(multiplyAndAdd5(5, 2)).toBe(15);
+});
diff --git a/test/composeRight/composeRight.test.js b/test/composeRight/composeRight.test.js
index f24024bdd..02cddf187 100644
--- a/test/composeRight/composeRight.test.js
+++ b/test/composeRight/composeRight.test.js
@@ -1,13 +1,12 @@
const expect = require('expect');
const composeRight = require('./composeRight.js');
-
- test('composeRight is a Function', () => {
+test('composeRight is a Function', () => {
expect(composeRight).toBeInstanceOf(Function);
});
- const add = (x, y) => x + y;
- const square = x => x * x;
- const addAndSquare = composeRight(add, square);
- t.equal(addAndSquare(1, 2), 9, "Performs left-to-right function composition");
-
-
+const add = (x, y) => x + y;
+const square = x => x * x;
+const addAndSquare = composeRight(add, square);
+test('Performs left-to-right function composition', () => {
+ expect(addAndSquare(1, 2)).toBe(9);
+});
diff --git a/test/converge/converge.test.js b/test/converge/converge.test.js
index bd8f4e4bd..67086df48 100644
--- a/test/converge/converge.test.js
+++ b/test/converge/converge.test.js
@@ -1,23 +1,20 @@
const expect = require('expect');
const converge = require('./converge.js');
-
- test('converge is a Function', () => {
+test('converge is a Function', () => {
expect(converge).toBeInstanceOf(Function);
});
- const average = converge((a, b) => a / b, [
- arr => arr.reduce((a, v) => a + v, 0),
- arr => arr.length,
- ]);
- test('Produces the average of the array', () => {
- expect(average([1, 2, 3, 4, 5, 6, 7]), 4).toBe()
+const average = converge((a, b) => a / b, [
+ arr => arr.reduce((a, v) => a + v, 0),
+ arr => arr.length,
+]);
+test('Produces the average of the array', () => {
+ expect(average([1, 2, 3, 4, 5, 6, 7])).toBe(4);
});
- const strangeConcat = converge((a, b) => a + b, [
- x => x.toUpperCase(),
- x => x.toLowerCase()]
- );
- test('Produces the strange concatenation', () => {
- expect(strangeConcat('Yodel'), "YODELyodel").toBe()
+const strangeConcat = converge((a, b) => a + b, [
+ x => x.toUpperCase(),
+ x => x.toLowerCase()]
+);
+test('Produces the strange concatenation', () => {
+ expect(strangeConcat('Yodel')).toBe('YODELyodel');
});
-
-
diff --git a/test/copyToClipboard/copyToClipboard.test.js b/test/copyToClipboard/copyToClipboard.test.js
index 66c5cb5bf..60c18bbb9 100644
--- a/test/copyToClipboard/copyToClipboard.test.js
+++ b/test/copyToClipboard/copyToClipboard.test.js
@@ -1,10 +1,6 @@
const expect = require('expect');
const copyToClipboard = require('./copyToClipboard.js');
-
- test('copyToClipboard is a Function', () => {
+test('copyToClipboard is a Function', () => {
expect(copyToClipboard).toBeInstanceOf(Function);
});
-
-
-
diff --git a/test/countBy/countBy.test.js b/test/countBy/countBy.test.js
index d013534ee..a33769895 100644
--- a/test/countBy/countBy.test.js
+++ b/test/countBy/countBy.test.js
@@ -1,15 +1,12 @@
const expect = require('expect');
const countBy = require('./countBy.js');
-
- test('countBy is a Function', () => {
+test('countBy is a Function', () => {
expect(countBy).toBeInstanceOf(Function);
});
- test('Works for functions', () => {
- expect(countBy([6.1, 4.2, 6.3], Math.floor), {4: 1, 6: 2}).toEqual()
+test('Works for functions', () => {
+ expect(countBy([6.1, 4.2, 6.3], Math.floor)).toEqual({4: 1, 6: 2});
});
- test('Works for property names', () => {
- expect(countBy(['one', 'two', 'three'], 'length'), {3: 2, 5: 1}).toEqual()
+test('Works for property names', () => {
+ expect(countBy(['one', 'two', 'three'], 'length')).toEqual({3: 2, 5: 1});
});
-
-
diff --git a/test/countOccurrences/countOccurrences.test.js b/test/countOccurrences/countOccurrences.test.js
index 1b43f1be8..f4cfab9b4 100644
--- a/test/countOccurrences/countOccurrences.test.js
+++ b/test/countOccurrences/countOccurrences.test.js
@@ -1,9 +1,9 @@
const expect = require('expect');
const countOccurrences = require('./countOccurrences.js');
-
- test('countOccurrences is a Function', () => {
+test('countOccurrences is a Function', () => {
expect(countOccurrences).toBeInstanceOf(Function);
});
- t.deepEqual(countOccurrences([1, 1, 2, 1, 2, 3], 1), 3, "Counts the occurrences of a value in an array");
-
+test('Counts the occurrences of a value in an array', () => {
+ expect(countOccurrences([1, 1, 2, 1, 2, 3], 1)).toEqual(3);
+});
diff --git a/test/countVowels/countVowels.test.js b/test/countVowels/countVowels.test.js
index dc5fc72a7..64a1b0936 100644
--- a/test/countVowels/countVowels.test.js
+++ b/test/countVowels/countVowels.test.js
@@ -1,8 +1,6 @@
const expect = require('expect');
const countVowels = require('./countVowels.js');
-
- test('countVowels is a Function', () => {
+test('countVowels is a Function', () => {
expect(countVowels).toBeInstanceOf(Function);
});
-
diff --git a/test/counter/counter.test.js b/test/counter/counter.test.js
index d7a7e4e91..a80d9c0f8 100644
--- a/test/counter/counter.test.js
+++ b/test/counter/counter.test.js
@@ -1,8 +1,6 @@
const expect = require('expect');
const counter = require('./counter.js');
-
- test('counter is a Function', () => {
+test('counter is a Function', () => {
expect(counter).toBeInstanceOf(Function);
});
-
diff --git a/test/createElement/createElement.test.js b/test/createElement/createElement.test.js
index d046f62e7..096080d8d 100644
--- a/test/createElement/createElement.test.js
+++ b/test/createElement/createElement.test.js
@@ -1,10 +1,6 @@
const expect = require('expect');
const createElement = require('./createElement.js');
-
- test('createElement is a Function', () => {
+test('createElement is a Function', () => {
expect(createElement).toBeInstanceOf(Function);
});
-
-
-
diff --git a/test/createEventHub/createEventHub.test.js b/test/createEventHub/createEventHub.test.js
index 4a847285e..701572373 100644
--- a/test/createEventHub/createEventHub.test.js
+++ b/test/createEventHub/createEventHub.test.js
@@ -1,10 +1,6 @@
const expect = require('expect');
const createEventHub = require('./createEventHub.js');
-
- test('createEventHub is a Function', () => {
+test('createEventHub is a Function', () => {
expect(createEventHub).toBeInstanceOf(Function);
});
-
-
-
diff --git a/test/currentURL/currentURL.test.js b/test/currentURL/currentURL.test.js
index 61c3a2fce..779470bde 100644
--- a/test/currentURL/currentURL.test.js
+++ b/test/currentURL/currentURL.test.js
@@ -1,10 +1,6 @@
const expect = require('expect');
const currentURL = require('./currentURL.js');
-
- test('currentURL is a Function', () => {
+test('currentURL is a Function', () => {
expect(currentURL).toBeInstanceOf(Function);
});
-
-
-
diff --git a/test/curry/curry.test.js b/test/curry/curry.test.js
index f97b6a260..4e7b215f6 100644
--- a/test/curry/curry.test.js
+++ b/test/curry/curry.test.js
@@ -1,10 +1,12 @@
const expect = require('expect');
const curry = require('./curry.js');
-
- test('curry is a Function', () => {
+test('curry is a Function', () => {
expect(curry).toBeInstanceOf(Function);
});
- t.equal(curry(Math.pow)(2)(10), 1024, "curries a Math.pow");
- t.equal(curry(Math.min, 3)(10)(50)(2), 2, "curries a Math.min");
-
+test('curries a Math.pow', () => {
+ expect(curry(Math.pow)(2)(10)).toBe(1024);
+});
+test('curries a Math.min', () => {
+ expect(curry(Math.min, 3)(10)(50)(2)).toBe(2);
+});
diff --git a/test/debounce/debounce.test.js b/test/debounce/debounce.test.js
index a4f4db6d2..b261f5f6d 100644
--- a/test/debounce/debounce.test.js
+++ b/test/debounce/debounce.test.js
@@ -1,10 +1,9 @@
const expect = require('expect');
const debounce = require('./debounce.js');
-
- test('debounce is a Function', () => {
+test('debounce is a Function', () => {
expect(debounce).toBeInstanceOf(Function);
});
- debounce(() => {
-
-
+test('Works as expected', () => {
+ debounce(() => { expect(true).toBeTruthy(); });
+});
diff --git a/test/decapitalize/decapitalize.test.js b/test/decapitalize/decapitalize.test.js
index 866c49271..e7a403388 100644
--- a/test/decapitalize/decapitalize.test.js
+++ b/test/decapitalize/decapitalize.test.js
@@ -1,15 +1,12 @@
const expect = require('expect');
const decapitalize = require('./decapitalize.js');
-
- test('decapitalize is a Function', () => {
+test('decapitalize is a Function', () => {
expect(decapitalize).toBeInstanceOf(Function);
});
- test('Works with default parameter', () => {
- expect(decapitalize('FooBar'), 'fooBar').toBe()
+test('Works with default parameter', () => {
+ expect(decapitalize('FooBar')).toBe('fooBar');
});
- test('Works with second parameter set to true', () => {
- expect(decapitalize('FooBar', true), 'fOOBAR').toBe()
+test('Works with second parameter set to true', () => {
+ expect(decapitalize('FooBar', true)).toBe('fOOBAR')
});
-
-
diff --git a/test/deepClone/deepClone.test.js b/test/deepClone/deepClone.test.js
index 8996449eb..8806fd060 100644
--- a/test/deepClone/deepClone.test.js
+++ b/test/deepClone/deepClone.test.js
@@ -1,17 +1,22 @@
const expect = require('expect');
const deepClone = require('./deepClone.js');
-
- test('deepClone is a Function', () => {
+test('deepClone is a Function', () => {
expect(deepClone).toBeInstanceOf(Function);
});
- const a = { foo: 'bar', obj: { a: 1, b: 2 } };
- const b = deepClone(a);
- const c = [{foo: "bar"}];
- const d = deepClone(c);
- t.notEqual(a, b, 'Shallow cloning works');
- t.notEqual(a.obj, b.obj, 'Deep cloning works');
- t.notEqual(c, d, "Array shallow cloning works");
- t.notEqual(c[0], d[0], "Array deep cloning works");
-
-
+const a = { foo: 'bar', obj: { a: 1, b: 2 } };
+const b = deepClone(a);
+const c = [{foo: "bar"}];
+const d = deepClone(c);
+test('Shallow cloning works', () => {
+ expect(a).not.toEqual(b);
+});
+test('Deep cloning works', () => {
+ expect(a.obj).not.toEqual(b.obj);
+});
+test('Array shallow cloning works', () => {
+ expect(c).not.toEqual(d);
+});
+test('Array deep cloning works', () => {
+ expect(c[0]).not.toEqual(d[0]);
+});
diff --git a/test/deepFlatten/deepFlatten.test.js b/test/deepFlatten/deepFlatten.test.js
index fa77ac6a7..fdaa404cb 100644
--- a/test/deepFlatten/deepFlatten.test.js
+++ b/test/deepFlatten/deepFlatten.test.js
@@ -1,9 +1,9 @@
const expect = require('expect');
const deepFlatten = require('./deepFlatten.js');
-
- test('deepFlatten is a Function', () => {
+test('deepFlatten is a Function', () => {
expect(deepFlatten).toBeInstanceOf(Function);
});
- t.deepEqual(deepFlatten([1, [2], [[3], 4], 5]), [1, 2, 3, 4, 5], "Deep flattens an array");
-
+test('Deep flattens an array', () => {
+ expect(deepFlatten([1, [2], [[3], 4], 5])).toEqual( [1, 2, 3, 4, 5]);
+});
diff --git a/test/defaults/defaults.test.js b/test/defaults/defaults.test.js
index c713eea1b..d416fef6a 100644
--- a/test/defaults/defaults.test.js
+++ b/test/defaults/defaults.test.js
@@ -1,12 +1,9 @@
const expect = require('expect');
const defaults = require('./defaults.js');
-
- test('defaults is a Function', () => {
+test('defaults is a Function', () => {
expect(defaults).toBeInstanceOf(Function);
});
- test('Assigns default values for undefined properties', () => {
- expect(defaults({ a: 1 }, { b: 2 }, { b: 6 }, { a: 3 }), { a: 1, b: 2 }).toEqual()
+test('Assigns default values for undefined properties', () => {
+ expect(defaults({ a: 1 }, { b: 2 }, { b: 6 }, { a: 3 })).toBe({ a: 1, b: 2 });
});
-
-
diff --git a/test/defer/defer.test.js b/test/defer/defer.test.js
index 46ff55ac6..61f3665f1 100644
--- a/test/defer/defer.test.js
+++ b/test/defer/defer.test.js
@@ -1,10 +1,6 @@
const expect = require('expect');
const defer = require('./defer.js');
-
- test('defer is a Function', () => {
+test('defer is a Function', () => {
expect(defer).toBeInstanceOf(Function);
});
-
-
-
diff --git a/test/degreesToRads/degreesToRads.test.js b/test/degreesToRads/degreesToRads.test.js
index a434d4bbd..634140d76 100644
--- a/test/degreesToRads/degreesToRads.test.js
+++ b/test/degreesToRads/degreesToRads.test.js
@@ -1,13 +1,10 @@
const expect = require('expect');
const degreesToRads = require('./degreesToRads.js');
-
- const approxeq = (v1,v2, diff = 0.001) => Math.abs(v1 - v2) < diff;
- test('degreesToRads is a Function', () => {
+// const approxeq = (v1,v2, diff = 0.001) => Math.abs(v1 - v2) < diff;
+test('degreesToRads is a Function', () => {
expect(degreesToRads).toBeInstanceOf(Function);
});
- test('Returns the appropriate value', () => {
- expect(approxeq(degreesToRads(90.0), Math.PI / 2)).toBeTruthy();
+test('Returns the appropriate value', () => {
+ expect(degreesToRads(90.0)).toBeCloseTo(Math.PI / 2, 3);
});
-
-
diff --git a/test/delay/delay.test.js b/test/delay/delay.test.js
index afe547b5f..b43e12552 100644
--- a/test/delay/delay.test.js
+++ b/test/delay/delay.test.js
@@ -1,18 +1,15 @@
const expect = require('expect');
const delay = require('./delay.js');
-
- test('delay is a Function', () => {
+test('delay is a Function', () => {
expect(delay).toBeInstanceOf(Function);
});
+test('Works as expecting, passing arguments properly', () => {
delay(
function(text) {
- test('Works as expecting, passing arguments properly', () => {
- expect(text, 'test').toBe()
-});
+ expect(text).toBe('test');
},
1000,
'test'
);
-
-
+});
diff --git a/test/detectDeviceType/detectDeviceType.test.js b/test/detectDeviceType/detectDeviceType.test.js
index 124315e80..695593771 100644
--- a/test/detectDeviceType/detectDeviceType.test.js
+++ b/test/detectDeviceType/detectDeviceType.test.js
@@ -1,10 +1,6 @@
const expect = require('expect');
const detectDeviceType = require('./detectDeviceType.js');
-
- test('detectDeviceType is a Function', () => {
+test('detectDeviceType is a Function', () => {
expect(detectDeviceType).toBeInstanceOf(Function);
});
-
-
-
diff --git a/test/difference/difference.test.js b/test/difference/difference.test.js
index 6062511a3..657ffe119 100644
--- a/test/difference/difference.test.js
+++ b/test/difference/difference.test.js
@@ -1,9 +1,9 @@
const expect = require('expect');
const difference = require('./difference.js');
-
- test('difference is a Function', () => {
+test('difference is a Function', () => {
expect(difference).toBeInstanceOf(Function);
});
- t.deepEqual(difference([1, 2, 3], [1, 2, 4]), [3], "Returns the difference between two arrays");
-
+test('Returns the difference between two arrays', () => {
+ expect(difference([1, 2, 3], [1, 2, 4])).toEqual([3])
+});
diff --git a/test/differenceBy/differenceBy.test.js b/test/differenceBy/differenceBy.test.js
index 44265c43f..6d312b981 100644
--- a/test/differenceBy/differenceBy.test.js
+++ b/test/differenceBy/differenceBy.test.js
@@ -1,15 +1,12 @@
const expect = require('expect');
const differenceBy = require('./differenceBy.js');
-
- test('differenceBy is a Function', () => {
+test('differenceBy is a Function', () => {
expect(differenceBy).toBeInstanceOf(Function);
});
- test('Works using a native function and numbers', () => {
- expect(differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor), [1.2]).toEqual()
+test('Works using a native function and numbers', () => {
+ expect(differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor)).toEqual( [1.2]);
});
- test('Works with arrow function and objects', () => {
- expect(differenceBy([{ x: 2 }, { x: 1 }], [{ x: 1 }], v => v.x), [ { x: 2 } ]).toEqual()
+test('Works with arrow function and objects', () => {
+ expect(differenceBy([{ x: 2 }, { x: 1 }], [{ x: 1 }], v => v.x)).toEqual([ { x: 2 } ]);
});
-
-
diff --git a/test/differenceWith/differenceWith.test.js b/test/differenceWith/differenceWith.test.js
index 2d840b5bf..76865cce2 100644
--- a/test/differenceWith/differenceWith.test.js
+++ b/test/differenceWith/differenceWith.test.js
@@ -1,9 +1,9 @@
const expect = require('expect');
const differenceWith = require('./differenceWith.js');
-
- test('differenceWith is a Function', () => {
+test('differenceWith is a Function', () => {
expect(differenceWith).toBeInstanceOf(Function);
});
- t.deepEqual(differenceWith([1, 1.2, 1.5, 3, 0], [1.9, 3, 0], (a, b) => Math.round(a) === Math.round(b)), [1, 1.2], "Filters out all values from an array");
-
+test('Filters out all values from an array', () => {
+ expect(differenceWith([1, 1.2, 1.5, 3, 0], [1.9, 3, 0], (a, b) => Math.round(a) === Math.round(b))).toEqual([1, 1.2]);
+});
diff --git a/test/digitize/digitize.test.js b/test/digitize/digitize.test.js
index 27ef11539..d25668443 100644
--- a/test/digitize/digitize.test.js
+++ b/test/digitize/digitize.test.js
@@ -1,9 +1,9 @@
const expect = require('expect');
const digitize = require('./digitize.js');
-
- test('digitize is a Function', () => {
+test('digitize is a Function', () => {
expect(digitize).toBeInstanceOf(Function);
});
- t.deepEqual(digitize(123), [1, 2, 3], "Converts a number to an array of digits");
-
+test('Converts a number to an array of digits', () => {
+ expect(digitize(123)).toEqual([1, 2,3])
+});
diff --git a/test/distance/distance.test.js b/test/distance/distance.test.js
index 769d128c2..7831be85d 100644
--- a/test/distance/distance.test.js
+++ b/test/distance/distance.test.js
@@ -1,12 +1,9 @@
const expect = require('expect');
const distance = require('./distance.js');
-
- test('distance is a Function', () => {
+test('distance is a Function', () => {
expect(distance).toBeInstanceOf(Function);
});
- test('Calculates the distance between two points', () => {
- expect(distance(1, 1, 2, 3), 2.23606797749979).toBe()
+test('Calculates the distance between two points', () => {
+ expect(distance(1, 1, 2, 3)).toBeCloseTo(2.23606797749979, 5);
});
-
-
diff --git a/test/drop/drop.test.js b/test/drop/drop.test.js
index 5c864463e..f9cc2f57b 100644
--- a/test/drop/drop.test.js
+++ b/test/drop/drop.test.js
@@ -1,18 +1,15 @@
const expect = require('expect');
const drop = require('./drop.js');
-
- test('drop is a Function', () => {
+test('drop is a Function', () => {
expect(drop).toBeInstanceOf(Function);
});
- test('Works without the last argument', () => {
- expect(drop([1, 2, 3]), [2,3]).toEqual()
+test('Works without the last argument', () => {
+ expect(drop([1, 2, 3])).toEqual([2,3]);
});
- test('Removes appropriate element count as specified', () => {
- expect(drop([1, 2, 3], 2), [3]).toEqual()
+test('Removes appropriate element count as specified', () => {
+ expect(drop([1, 2, 3], 2)).toEqual([3]);
});
- test('Empties array given a count greater than length', () => {
- expect(drop([1, 2, 3], 42), []).toEqual()
+test('Empties array given a count greater than length', () => {
+ expect(drop([1, 2, 3], 42)).toEqual([]);
});
-
-
diff --git a/test/dropRight/dropRight.test.js b/test/dropRight/dropRight.test.js
index e5d4523ec..f9927ac4b 100644
--- a/test/dropRight/dropRight.test.js
+++ b/test/dropRight/dropRight.test.js
@@ -1,11 +1,15 @@
const expect = require('expect');
const dropRight = require('./dropRight.js');
-
- test('dropRight is a Function', () => {
+test('dropRight is a Function', () => {
expect(dropRight).toBeInstanceOf(Function);
});
- t.deepEqual(dropRight([1, 2, 3]), [1,2], "Returns a new array with n elements removed from the right");
- t.deepEqual(dropRight([1, 2, 3], 2), [1], "Returns a new array with n elements removed from the right");
- t.deepEqual(dropRight([1, 2, 3], 42), [], "Returns a new array with n elements removed from the right");
-
+test('Returns a new array with n elements removed from the right', () => {
+ expect(dropRight([1, 2, 3])).toEqual([1, 2])
+});
+test('Returns a new array with n elements removed from the right', () => {
+ expect(dropRight([1, 2, 3], 2)).toEqual([1]);
+});
+test('Returns a new array with n elements removed from the right', () => {
+ expect(dropRight([1, 2, 3], 42)).toEqual([]);
+});
diff --git a/test/dropRightWhile/dropRightWhile.test.js b/test/dropRightWhile/dropRightWhile.test.js
index 228dea2e3..ad39f35f9 100644
--- a/test/dropRightWhile/dropRightWhile.test.js
+++ b/test/dropRightWhile/dropRightWhile.test.js
@@ -1,12 +1,9 @@
const expect = require('expect');
const dropRightWhile = require('./dropRightWhile.js');
-
- test('dropRightWhile is a Function', () => {
+test('dropRightWhile is a Function', () => {
expect(dropRightWhile).toBeInstanceOf(Function);
});
- 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()
+test('Removes elements from the end of an array until the passed function returns true.', () => {
+ expect(dropRightWhile([1, 2, 3, 4], n => n < 3)).toEqual([1, 2])
});
-
-
diff --git a/test/dropWhile/dropWhile.test.js b/test/dropWhile/dropWhile.test.js
index 4bff04c43..75bc3272e 100644
--- a/test/dropWhile/dropWhile.test.js
+++ b/test/dropWhile/dropWhile.test.js
@@ -1,12 +1,9 @@
const expect = require('expect');
const dropWhile = require('./dropWhile.js');
-
- test('dropWhile is a Function', () => {
+test('dropWhile is a Function', () => {
expect(dropWhile).toBeInstanceOf(Function);
});
- test('Removes elements in an array until the passed function returns true.', () => {
- expect(dropWhile([1, 2, 3, 4], n => n >= 3), [3,4]).toEqual()
+test('Removes elements in an array until the passed function returns true.', () => {
+ expect(dropWhile([1, 2, 3, 4], n => n >= 3)).toEqual([3,4])
});
-
-
diff --git a/test/elo/elo.test.js b/test/elo/elo.test.js
index 28aaf5c5c..2868b5fbc 100644
--- a/test/elo/elo.test.js
+++ b/test/elo/elo.test.js
@@ -5,7 +5,11 @@ const elo = require('./elo.js');
test('elo is a Function', () => {
expect(elo).toBeInstanceOf(Function);
});
- t.deepEqual(elo([1200, 1200]), [1216, 1184], "Standard 1v1s");
+ test('Standard 1v1s', () => {
+ expect(elo([1200, 1200]), [1216).toEqual(1184])
+});
t.deepEqual(elo([1200, 1200], 64), [1232, 1168]), "Standard 1v1s";
- t.deepEqual(elo([1200, 1200, 1200, 1200]).map(Math.round), [1246, 1215, 1185, 1154], "4 player FFA, all same rank");
+ test('4 player FFA, all same rank', () => {
+ expect(elo([1200, 1200, 1200, 1200]).map(Math.round), [1246, 1215, 1185).toEqual(1154])
+});
diff --git a/test/equals/equals.test.js b/test/equals/equals.test.js
index 4cdb12e39..c6622d169 100644
--- a/test/equals/equals.test.js
+++ b/test/equals/equals.test.js
@@ -5,7 +5,9 @@ const equals = require('./equals.js');
test('equals is a Function', () => {
expect(equals).toBeInstanceOf(Function);
});
- t.true(equals({ a: [2, {e: 3}], b: [4], c: 'foo' }, { a: [2, {e: 3}], b: [4], c: 'foo' }), "{ a: [2, {e: 3}], b: [4], c: 'foo' } is equal to { a: [2, {e: 3}], b: [4], c: 'foo' }");
+ test('{ a: [2, {e: 3}], b: [4], c: 'foo' } is equal to { a: [2, {e: 3}], b: [4], c: 'foo' }', () => {
+ expect(equals({ a: [2, {e: 3}], b: [4], c: 'foo' }, { a: [2, {e: 3}], b: [4], c: 'foo' })).toBeTruthy()
+});
test('[1,2,3] is equal to [1,2,3]', () => {
expect(equals([1, 2, 3], [1, 2, 3])).toBeTruthy();
});
diff --git a/test/escapeHTML/escapeHTML.test.js b/test/escapeHTML/escapeHTML.test.js
index 8d280f42e..748a10562 100644
--- a/test/escapeHTML/escapeHTML.test.js
+++ b/test/escapeHTML/escapeHTML.test.js
@@ -5,5 +5,7 @@ const escapeHTML = require('./escapeHTML.js');
test('escapeHTML is a Function', () => {
expect(escapeHTML).toBeInstanceOf(Function);
});
- t.equal(escapeHTML('Me & you'), '<a href="#">Me & you</a>', "Escapes a string for use in HTML");
+ test('Escapes a string for use in HTML', () => {
+ expect(escapeHTML('Me & you')).toBe('<a href="#">Me & you</a>')
+});
diff --git a/test/escapeRegExp/escapeRegExp.test.js b/test/escapeRegExp/escapeRegExp.test.js
index a39ebd21e..8483c0a88 100644
--- a/test/escapeRegExp/escapeRegExp.test.js
+++ b/test/escapeRegExp/escapeRegExp.test.js
@@ -5,5 +5,7 @@ const escapeRegExp = require('./escapeRegExp.js');
test('escapeRegExp is a Function', () => {
expect(escapeRegExp).toBeInstanceOf(Function);
});
- t.equal(escapeRegExp('(test)'), '\\(test\\)', "Escapes a string to use in a regular expression");
+ test('Escapes a string to use in a regular expression', () => {
+ expect(escapeRegExp('(test)')).toBe('\\(test\\)')
+});
diff --git a/test/everyNth/everyNth.test.js b/test/everyNth/everyNth.test.js
index 4bc7aabea..09918d3e0 100644
--- a/test/everyNth/everyNth.test.js
+++ b/test/everyNth/everyNth.test.js
@@ -5,5 +5,7 @@ const everyNth = require('./everyNth.js');
test('everyNth is a Function', () => {
expect(everyNth).toBeInstanceOf(Function);
});
- t.deepEqual(everyNth([1, 2, 3, 4, 5, 6], 2), [ 2, 4, 6 ], "Returns every nth element in an array");
+ test('Returns every nth element in an array', () => {
+ expect(everyNth([1, 2, 3, 4, 5, 6], 2), [ 2, 4).toEqual(6 ])
+});
diff --git a/test/extendHex/extendHex.test.js b/test/extendHex/extendHex.test.js
index 798dee0e6..c196899e7 100644
--- a/test/extendHex/extendHex.test.js
+++ b/test/extendHex/extendHex.test.js
@@ -5,6 +5,10 @@ const extendHex = require('./extendHex.js');
test('extendHex is a Function', () => {
expect(extendHex).toBeInstanceOf(Function);
});
- t.equal(extendHex('#03f'), '#0033ff', "Extends a 3-digit color code to a 6-digit color code");
- t.equal(extendHex('05a'), '#0055aa', "Extends a 3-digit color code to a 6-digit color code");
+ test('Extends a 3-digit color code to a 6-digit color code', () => {
+ expect(extendHex('#03f')).toBe('#0033ff')
+});
+ test('Extends a 3-digit color code to a 6-digit color code', () => {
+ expect(extendHex('05a')).toBe('#0055aa')
+});
diff --git a/test/factorial/factorial.test.js b/test/factorial/factorial.test.js
index 7bf338a83..d13f79f2c 100644
--- a/test/factorial/factorial.test.js
+++ b/test/factorial/factorial.test.js
@@ -5,9 +5,19 @@ const factorial = require('./factorial.js');
test('factorial is a Function', () => {
expect(factorial).toBeInstanceOf(Function);
});
- t.equal(factorial(6), 720, "Calculates the factorial of 720");
- t.equal(factorial(0), 1, "Calculates the factorial of 0");
- t.equal(factorial(1), 1, "Calculates the factorial of 1");
- t.equal(factorial(4), 24, "Calculates the factorial of 4");
- t.equal(factorial(10), 3628800, "Calculates the factorial of 10");
+ test('Calculates the factorial of 720', () => {
+ expect(factorial(6)).toBe(720)
+});
+ test('Calculates the factorial of 0', () => {
+ expect(factorial(0)).toBe(1)
+});
+ test('Calculates the factorial of 1', () => {
+ expect(factorial(1)).toBe(1)
+});
+ test('Calculates the factorial of 4', () => {
+ expect(factorial(4)).toBe(24)
+});
+ test('Calculates the factorial of 10', () => {
+ expect(factorial(10)).toBe(3628800)
+});
diff --git a/test/fibonacci/fibonacci.test.js b/test/fibonacci/fibonacci.test.js
index 6db435ec9..5a44cba21 100644
--- a/test/fibonacci/fibonacci.test.js
+++ b/test/fibonacci/fibonacci.test.js
@@ -5,5 +5,7 @@ const fibonacci = require('./fibonacci.js');
test('fibonacci is a Function', () => {
expect(fibonacci).toBeInstanceOf(Function);
});
- t.deepEqual(fibonacci(6), [0, 1, 1, 2, 3, 5], "Generates an array, containing the Fibonacci sequence");
+ test('Generates an array, containing the Fibonacci sequence', () => {
+ expect(fibonacci(6), [0, 1, 1, 2, 3).toEqual(5])
+});
diff --git a/test/filterNonUnique/filterNonUnique.test.js b/test/filterNonUnique/filterNonUnique.test.js
index 003c26e07..faa135e79 100644
--- a/test/filterNonUnique/filterNonUnique.test.js
+++ b/test/filterNonUnique/filterNonUnique.test.js
@@ -5,5 +5,7 @@ const filterNonUnique = require('./filterNonUnique.js');
test('filterNonUnique is a Function', () => {
expect(filterNonUnique).toBeInstanceOf(Function);
});
- t.deepEqual(filterNonUnique([1, 2, 2, 3, 4, 4, 5]), [1,3,5], "Filters out the non-unique values in an array");
+ test('Filters out the non-unique values in an array', () => {
+ expect(filterNonUnique([1, 2, 2, 3, 4, 4, 5]), [1,3).toEqual(5])
+});
diff --git a/test/flatten/flatten.test.js b/test/flatten/flatten.test.js
index fa1c01167..a912af451 100644
--- a/test/flatten/flatten.test.js
+++ b/test/flatten/flatten.test.js
@@ -5,6 +5,10 @@ const flatten = require('./flatten.js');
test('flatten is a Function', () => {
expect(flatten).toBeInstanceOf(Function);
});
- t.deepEqual(flatten([1, [2], 3, 4]), [1, 2, 3, 4], "Flattens an array");
- t.deepEqual(flatten([1, [2, [3, [4, 5], 6], 7], 8], 2), [1, 2, 3, [4, 5], 6, 7, 8], "Flattens an array");
+ test('Flattens an array', () => {
+ expect(flatten([1, [2], 3, 4]), [1, 2, 3).toEqual(4])
+});
+ test('Flattens an array', () => {
+ expect(flatten([1, [2, [3, [4, 5], 6], 7], 8], 2), [1, 2, 3, [4, 5], 6, 7).toEqual(8])
+});
diff --git a/test/formatDuration/formatDuration.test.js b/test/formatDuration/formatDuration.test.js
index c1b9e7306..fbef44981 100644
--- a/test/formatDuration/formatDuration.test.js
+++ b/test/formatDuration/formatDuration.test.js
@@ -5,6 +5,10 @@ const formatDuration = require('./formatDuration.js');
test('formatDuration is a Function', () => {
expect(formatDuration).toBeInstanceOf(Function);
});
- t.equal(formatDuration(1001), '1 second, 1 millisecond', "Returns the human readable format of the given number of milliseconds");
- t.equal(formatDuration(34325055574), '397 days, 6 hours, 44 minutes, 15 seconds, 574 milliseconds', "Returns the human readable format of the given number of milliseconds");
+ test('Returns the human readable format of the given number of milliseconds', () => {
+ expect(formatDuration(1001), '1 second).toBe(1 millisecond')
+});
+ test('Returns the human readable format of the given number of milliseconds', () => {
+ expect(formatDuration(34325055574), '397 days, 6 hours, 44 minutes, 15 seconds).toBe(574 milliseconds')
+});
diff --git a/test/fromCamelCase/fromCamelCase.test.js b/test/fromCamelCase/fromCamelCase.test.js
index 5e89f57b6..c20257ab1 100644
--- a/test/fromCamelCase/fromCamelCase.test.js
+++ b/test/fromCamelCase/fromCamelCase.test.js
@@ -5,7 +5,13 @@ const fromCamelCase = require('./fromCamelCase.js');
test('fromCamelCase is a Function', () => {
expect(fromCamelCase).toBeInstanceOf(Function);
});
- t.equal(fromCamelCase('someDatabaseFieldName', ' '), 'some database field name', "Converts a string from camelcase");
- t.equal(fromCamelCase('someLabelThatNeedsToBeCamelized', '-'), 'some-label-that-needs-to-be-camelized', "Converts a string from camelcase");
- t.equal(fromCamelCase('someJavascriptProperty', '_'), 'some_javascript_property', "Converts a string from camelcase");
+ test('Converts a string from camelcase', () => {
+ expect(fromCamelCase('someDatabaseFieldName', ' ')).toBe('some database field name')
+});
+ test('Converts a string from camelcase', () => {
+ expect(fromCamelCase('someLabelThatNeedsToBeCamelized', '-')).toBe('some-label-that-needs-to-be-camelized')
+});
+ test('Converts a string from camelcase', () => {
+ expect(fromCamelCase('someJavascriptProperty', '_')).toBe('some_javascript_property')
+});
diff --git a/test/gcd/gcd.test.js b/test/gcd/gcd.test.js
index 70fa782f5..f95f944a5 100644
--- a/test/gcd/gcd.test.js
+++ b/test/gcd/gcd.test.js
@@ -5,6 +5,10 @@ const gcd = require('./gcd.js');
test('gcd is a Function', () => {
expect(gcd).toBeInstanceOf(Function);
});
- t.equal(gcd(8, 36), 4, "Calculates the greatest common divisor between two or more numbers/arrays");
- t.deepEqual(gcd(...[12, 8, 32]), 4, "Calculates the greatest common divisor between two or more numbers/arrays");
+ test('Calculates the greatest common divisor between two or more numbers/arrays', () => {
+ expect(gcd(8, 36)).toBe(4)
+});
+ test('Calculates the greatest common divisor between two or more numbers/arrays', () => {
+ expect(gcd(...[12, 8, 32])).toEqual(4)
+});
diff --git a/test/geometricProgression/geometricProgression.test.js b/test/geometricProgression/geometricProgression.test.js
index f42e0aafb..50fba67d1 100644
--- a/test/geometricProgression/geometricProgression.test.js
+++ b/test/geometricProgression/geometricProgression.test.js
@@ -5,7 +5,13 @@ const geometricProgression = require('./geometricProgression.js');
test('geometricProgression is a Function', () => {
expect(geometricProgression).toBeInstanceOf(Function);
});
- t.deepEqual(geometricProgression(256), [1, 2, 4, 8, 16, 32, 64, 128, 256], "Initializes an array containing the numbers in the specified range");
- t.deepEqual(geometricProgression(256, 3), [3, 6, 12, 24, 48, 96, 192], "Initializes an array containing the numbers in the specified range");
- t.deepEqual(geometricProgression(256, 1, 4), [1, 4, 16, 64, 256], "Initializes an array containing the numbers in the specified range");
+ test('Initializes an array containing the numbers in the specified range', () => {
+ expect(geometricProgression(256), [1, 2, 4, 8, 16, 32, 64, 128).toEqual(256])
+});
+ test('Initializes an array containing the numbers in the specified range', () => {
+ expect(geometricProgression(256, 3), [3, 6, 12, 24, 48, 96).toEqual(192])
+});
+ test('Initializes an array containing the numbers in the specified range', () => {
+ expect(geometricProgression(256, 1, 4), [1, 4, 16, 64).toEqual(256])
+});
diff --git a/test/get/get.test.js b/test/get/get.test.js
index 667f3e104..facab132c 100644
--- a/test/get/get.test.js
+++ b/test/get/get.test.js
@@ -6,6 +6,8 @@ const get = require('./get.js');
expect(get).toBeInstanceOf(Function);
});
const obj = { selector: { to: { val: 'val to get' } } };
- t.deepEqual(get(obj, 'selector.to.val'), ['val to get'], "Retrieve a property indicated by the selector from an object.");
+ test('Retrieve a property indicated by the selector from an object.', () => {
+ expect(get(obj, 'selector.to.val')).toEqual(['val to get'])
+});
diff --git a/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.test.js b/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.test.js
index 25052d94d..205eb4298 100644
--- a/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.test.js
+++ b/test/getDaysDiffBetweenDates/getDaysDiffBetweenDates.test.js
@@ -5,5 +5,7 @@ const getDaysDiffBetweenDates = require('./getDaysDiffBetweenDates.js');
test('getDaysDiffBetweenDates is a Function', () => {
expect(getDaysDiffBetweenDates).toBeInstanceOf(Function);
});
- t.equal(getDaysDiffBetweenDates(new Date('2017-12-13'), new Date('2017-12-22')), 9, "Returns the difference in days between two dates");
+ test('Returns the difference in days between two dates', () => {
+ expect(getDaysDiffBetweenDates(new Date('2017-12-13'), new Date('2017-12-22'))).toBe(9)
+});
diff --git a/test/getType/getType.test.js b/test/getType/getType.test.js
index dedd1d8b5..68222a194 100644
--- a/test/getType/getType.test.js
+++ b/test/getType/getType.test.js
@@ -5,5 +5,7 @@ const getType = require('./getType.js');
test('getType is a Function', () => {
expect(getType).toBeInstanceOf(Function);
});
- t.equal(getType(new Set([1, 2, 3])), 'set', "Returns the native type of a value");
+ test('Returns the native type of a value', () => {
+ expect(getType(new Set([1, 2, 3]))).toBe('set')
+});
diff --git a/test/groupBy/groupBy.test.js b/test/groupBy/groupBy.test.js
index 194886b8d..4e34675e5 100644
--- a/test/groupBy/groupBy.test.js
+++ b/test/groupBy/groupBy.test.js
@@ -5,6 +5,10 @@ const groupBy = require('./groupBy.js');
test('groupBy is a Function', () => {
expect(groupBy).toBeInstanceOf(Function);
});
- t.deepEqual(groupBy([6.1, 4.2, 6.3], Math.floor), {4: [4.2], 6: [6.1, 6.3]}, "Groups the elements of an array based on the given function");
- t.deepEqual(groupBy(['one', 'two', 'three'], 'length'), {3: ['one', 'two'], 5: ['three']}, "Groups the elements of an array based on the given function");
+ test('Groups the elements of an array based on the given function', () => {
+ expect(groupBy([6.1, 4.2, 6.3], Math.floor), {4: [4.2], 6: [6.1).toEqual(6.3]})
+});
+ test('Groups the elements of an array based on the given function', () => {
+ expect(groupBy(['one', 'two', 'three'], 'length'), {3: ['one', 'two']).toEqual(5: ['three']})
+});
diff --git a/test/hammingDistance/hammingDistance.test.js b/test/hammingDistance/hammingDistance.test.js
index f72b78043..913a60018 100644
--- a/test/hammingDistance/hammingDistance.test.js
+++ b/test/hammingDistance/hammingDistance.test.js
@@ -5,5 +5,7 @@ const hammingDistance = require('./hammingDistance.js');
test('hammingDistance is a Function', () => {
expect(hammingDistance).toBeInstanceOf(Function);
});
- t.equal(hammingDistance(2, 3), 1, "retuns hamming disance between 2 values");
+ test('retuns hamming disance between 2 values', () => {
+ expect(hammingDistance(2, 3)).toBe(1)
+});
diff --git a/test/head/head.test.js b/test/head/head.test.js
index fd29c145c..f7644c2a5 100644
--- a/test/head/head.test.js
+++ b/test/head/head.test.js
@@ -8,7 +8,9 @@ const head = require('./head.js');
test('head({ a: 1234}) returns undefined', () => {
expect(head({ a: 1234}) === undefined).toBeTruthy();
});
- t.equal(head([1, 2, 3]), 1, "head([1, 2, 3]) returns 1");
+ test('head([1, 2, 3]) returns 1', () => {
+ expect(head([1, 2, 3])).toBe(1)
+});
test('head({ 0: false}) returns false', () => {
expect(head({ 0: false}), false).toBe()
});
diff --git a/test/hexToRGB/hexToRGB.test.js b/test/hexToRGB/hexToRGB.test.js
index a3ffd412c..d470a1803 100644
--- a/test/hexToRGB/hexToRGB.test.js
+++ b/test/hexToRGB/hexToRGB.test.js
@@ -5,7 +5,13 @@ const hexToRGB = require('./hexToRGB.js');
test('hexToRGB is a Function', () => {
expect(hexToRGB).toBeInstanceOf(Function);
});
- t.equal(hexToRGB('#27ae60ff'), 'rgba(39, 174, 96, 255)', "Converts a color code to a rgb() or rgba() string");
- t.equal(hexToRGB('27ae60'), 'rgb(39, 174, 96)', "Converts a color code to a rgb() or rgba() string");
- t.equal(hexToRGB('#fff'), 'rgb(255, 255, 255)', "Converts a color code to a rgb() or rgba() string");
+ test('Converts a color code to a rgb() or rgba() string', () => {
+ expect(hexToRGB('#27ae60ff'), 'rgba(39, 174, 96).toBe(255)')
+});
+ test('Converts a color code to a rgb() or rgba() string', () => {
+ expect(hexToRGB('27ae60'), 'rgb(39, 174).toBe(96)')
+});
+ test('Converts a color code to a rgb() or rgba() string', () => {
+ expect(hexToRGB('#fff'), 'rgb(255, 255).toBe(255)')
+});
diff --git a/test/inRange/inRange.test.js b/test/inRange/inRange.test.js
index 545c3991a..0a61db452 100644
--- a/test/inRange/inRange.test.js
+++ b/test/inRange/inRange.test.js
@@ -5,8 +5,16 @@ const inRange = require('./inRange.js');
test('inRange is a Function', () => {
expect(inRange).toBeInstanceOf(Function);
});
- t.equal(inRange(3, 2, 5), true, "The given number falls within the given range");
- t.equal(inRange(3, 4), true, "The given number falls within the given range");
- t.equal(inRange(2, 3, 5), false, "The given number does not falls within the given range");
- t.equal(inRange(3, 2), false, "The given number does not falls within the given range");
+ test('The given number falls within the given range', () => {
+ expect(inRange(3, 2, 5)).toBe(true)
+});
+ test('The given number falls within the given range', () => {
+ expect(inRange(3, 4)).toBe(true)
+});
+ test('The given number does not falls within the given range', () => {
+ expect(inRange(2, 3, 5)).toBe(false)
+});
+ test('The given number does not falls within the given range', () => {
+ expect(inRange(3, 2)).toBe(false)
+});
diff --git a/test/indexOfAll/indexOfAll.test.js b/test/indexOfAll/indexOfAll.test.js
index 21fbb0cf3..f694d6a7b 100644
--- a/test/indexOfAll/indexOfAll.test.js
+++ b/test/indexOfAll/indexOfAll.test.js
@@ -5,6 +5,10 @@ const indexOfAll = require('./indexOfAll.js');
test('indexOfAll is a Function', () => {
expect(indexOfAll).toBeInstanceOf(Function);
});
- t.deepEqual(indexOfAll([1, 2, 3, 1, 2, 3], 1), [0,3], "Returns all indices of val in an array");
- t.deepEqual(indexOfAll([1, 2, 3], 4), [], "Returns all indices of val in an array");
+ test('Returns all indices of val in an array', () => {
+ expect(indexOfAll([1, 2, 3, 1, 2, 3], 1), [0).toEqual(3])
+});
+ test('Returns all indices of val in an array', () => {
+ expect(indexOfAll([1, 2, 3], 4)).toEqual([])
+});
diff --git a/test/initial/initial.test.js b/test/initial/initial.test.js
index 7dd301fe4..2659c902b 100644
--- a/test/initial/initial.test.js
+++ b/test/initial/initial.test.js
@@ -5,5 +5,7 @@ const initial = require('./initial.js');
test('initial is a Function', () => {
expect(initial).toBeInstanceOf(Function);
});
- t.deepEqual(initial([1, 2, 3]), [1, 2], "Returns all the elements of an array except the last one");
+ test('Returns all the elements of an array except the last one', () => {
+ expect(initial([1, 2, 3]), [1).toEqual(2])
+});
diff --git a/test/initialize2DArray/initialize2DArray.test.js b/test/initialize2DArray/initialize2DArray.test.js
index 441c34a4a..ee00d7560 100644
--- a/test/initialize2DArray/initialize2DArray.test.js
+++ b/test/initialize2DArray/initialize2DArray.test.js
@@ -5,5 +5,7 @@ const initialize2DArray = require('./initialize2DArray.js');
test('initialize2DArray is a Function', () => {
expect(initialize2DArray).toBeInstanceOf(Function);
});
- t.deepEqual(initialize2DArray(2, 2, 0), [[0,0], [0,0]], "Initializes a 2D array of given width and height and value");
+ test('Initializes a 2D array of given width and height and value', () => {
+ expect(initialize2DArray(2, 2, 0), [[0,0], [0).toEqual(0]])
+});
diff --git a/test/initializeArrayWithRange/initializeArrayWithRange.test.js b/test/initializeArrayWithRange/initializeArrayWithRange.test.js
index 18da3a9e4..23fedd17b 100644
--- a/test/initializeArrayWithRange/initializeArrayWithRange.test.js
+++ b/test/initializeArrayWithRange/initializeArrayWithRange.test.js
@@ -5,5 +5,7 @@ const initializeArrayWithRange = require('./initializeArrayWithRange.js');
test('initializeArrayWithRange is a Function', () => {
expect(initializeArrayWithRange).toBeInstanceOf(Function);
});
- t.deepEqual(initializeArrayWithRange(5), [0, 1, 2, 3, 4, 5], "Initializes an array containing the numbers in the specified range");
+ test('Initializes an array containing the numbers in the specified range', () => {
+ expect(initializeArrayWithRange(5), [0, 1, 2, 3, 4).toEqual(5])
+});
diff --git a/test/initializeArrayWithValues/initializeArrayWithValues.test.js b/test/initializeArrayWithValues/initializeArrayWithValues.test.js
index ee1f5ea89..6b6861f46 100644
--- a/test/initializeArrayWithValues/initializeArrayWithValues.test.js
+++ b/test/initializeArrayWithValues/initializeArrayWithValues.test.js
@@ -5,5 +5,7 @@ const initializeArrayWithValues = require('./initializeArrayWithValues.js');
test('initializeArrayWithValues is a Function', () => {
expect(initializeArrayWithValues).toBeInstanceOf(Function);
});
- t.deepEqual(initializeArrayWithValues(5, 2), [2, 2, 2, 2, 2], "Initializes and fills an array with the specified values");
+ test('Initializes and fills an array with the specified values', () => {
+ expect(initializeArrayWithValues(5, 2), [2, 2, 2, 2).toEqual(2])
+});
diff --git a/test/intersection/intersection.test.js b/test/intersection/intersection.test.js
index e94b8df5e..72316771f 100644
--- a/test/intersection/intersection.test.js
+++ b/test/intersection/intersection.test.js
@@ -5,5 +5,7 @@ const intersection = require('./intersection.js');
test('intersection is a Function', () => {
expect(intersection).toBeInstanceOf(Function);
});
- t.deepEqual(intersection([1, 2, 3], [4, 3, 2]), [2, 3], "Returns a list of elements that exist in both arrays");
+ test('Returns a list of elements that exist in both arrays', () => {
+ expect(intersection([1, 2, 3], [4, 3, 2]), [2).toEqual(3])
+});
diff --git a/test/invertKeyValues/invertKeyValues.test.js b/test/invertKeyValues/invertKeyValues.test.js
index 2619e5814..0c036fc66 100644
--- a/test/invertKeyValues/invertKeyValues.test.js
+++ b/test/invertKeyValues/invertKeyValues.test.js
@@ -5,6 +5,10 @@ const invertKeyValues = require('./invertKeyValues.js');
test('invertKeyValues is a Function', () => {
expect(invertKeyValues).toBeInstanceOf(Function);
});
- t.deepEqual(invertKeyValues({ a: 1, b: 2, c: 1 }), { 1: [ 'a', 'c' ], 2: [ 'b' ] }, "invertKeyValues({ a: 1, b: 2, c: 1 }) returns { 1: [ 'a', 'c' ], 2: [ 'b' ] }");
- t.deepEqual(invertKeyValues({ a: 1, b: 2, c: 1 }, value => 'group' + value), { group1: [ 'a', 'c' ], group2: [ 'b' ] }, "invertKeyValues({ a: 1, b: 2, c: 1 }, value => 'group' + value) returns { group1: [ 'a', 'c' ], group2: [ 'b' ] }");
+ test('invertKeyValues({ a: 1, b: 2, c: 1 }) returns { 1: [ 'a', 'c' ], 2: [ 'b' ] }', () => {
+ expect(invertKeyValues({ a: 1, b: 2, c: 1 }), { 1: [ 'a', 'c' ]).toEqual(2: [ 'b' ] })
+});
+ test('invertKeyValues({ a: 1, b: 2, c: 1 }, value => 'group' + value) returns { group1: [ 'a', 'c' ], group2: [ 'b' ] }', () => {
+ expect(invertKeyValues({ a: 1, b: 2, c: 1 }, value => 'group' + value), { group1: [ 'a', 'c' ]).toEqual(group2: [ 'b' ] })
+});
diff --git a/test/isAbsoluteURL/isAbsoluteURL.test.js b/test/isAbsoluteURL/isAbsoluteURL.test.js
index 81dfb2539..0ddda8fbb 100644
--- a/test/isAbsoluteURL/isAbsoluteURL.test.js
+++ b/test/isAbsoluteURL/isAbsoluteURL.test.js
@@ -7,5 +7,7 @@ const isAbsoluteURL = require('./isAbsoluteURL.js');
});
t.equal(isAbsoluteURL('https:
t.equal(isAbsoluteURL('ftp:
- t.equal(isAbsoluteURL('/foo/bar'), false, "Given string is not an absolute URL");
+ test('Given string is not an absolute URL', () => {
+ expect(isAbsoluteURL('/foo/bar')).toBe(false)
+});
diff --git a/test/isArray/isArray.test.js b/test/isArray/isArray.test.js
index a14d72e1f..63064f7bd 100644
--- a/test/isArray/isArray.test.js
+++ b/test/isArray/isArray.test.js
@@ -5,6 +5,10 @@ const isArray = require('./isArray.js');
test('isArray is a Function', () => {
expect(isArray).toBeInstanceOf(Function);
});
- t.equal(isArray([1]), true, "passed value is an array");
- t.equal(isArray('array'), false, "passed value is not an array");
+ test('passed value is an array', () => {
+ expect(isArray([1])).toBe(true)
+});
+ test('passed value is not an array', () => {
+ expect(isArray('array')).toBe(false)
+});
diff --git a/test/isBoolean/isBoolean.test.js b/test/isBoolean/isBoolean.test.js
index 68b737800..e362c7b3e 100644
--- a/test/isBoolean/isBoolean.test.js
+++ b/test/isBoolean/isBoolean.test.js
@@ -5,6 +5,10 @@ const isBoolean = require('./isBoolean.js');
test('isBoolean is a Function', () => {
expect(isBoolean).toBeInstanceOf(Function);
});
- t.equal(isBoolean(null), false, "passed value is not a boolean");
- t.equal(isBoolean(false), true, "passed value is not a boolean");
+ test('passed value is not a boolean', () => {
+ expect(isBoolean(null)).toBe(false)
+});
+ test('passed value is not a boolean', () => {
+ expect(isBoolean(false)).toBe(true)
+});
diff --git a/test/isFunction/isFunction.test.js b/test/isFunction/isFunction.test.js
index 030d4b73f..50d8e7579 100644
--- a/test/isFunction/isFunction.test.js
+++ b/test/isFunction/isFunction.test.js
@@ -5,6 +5,10 @@ const isFunction = require('./isFunction.js');
test('isFunction is a Function', () => {
expect(isFunction).toBeInstanceOf(Function);
});
- t.equal(isFunction(x => x), true, "passed value is a function");
- t.equal(isFunction('x'), false, "passed value is not a function");
+ test('passed value is a function', () => {
+ expect(isFunction(x => x)).toBe(true)
+});
+ test('passed value is not a function', () => {
+ expect(isFunction('x')).toBe(false)
+});
diff --git a/test/isLowerCase/isLowerCase.test.js b/test/isLowerCase/isLowerCase.test.js
index 90f795f50..486345594 100644
--- a/test/isLowerCase/isLowerCase.test.js
+++ b/test/isLowerCase/isLowerCase.test.js
@@ -5,7 +5,13 @@ const isLowerCase = require('./isLowerCase.js');
test('isLowerCase is a Function', () => {
expect(isLowerCase).toBeInstanceOf(Function);
});
- t.equal(isLowerCase('abc'), true, "passed string is a lowercase");
- t.equal(isLowerCase('a3@$'), true, "passed string is a lowercase");
- t.equal(isLowerCase('A3@$'), false, "passed value is not a lowercase");
+ test('passed string is a lowercase', () => {
+ expect(isLowerCase('abc')).toBe(true)
+});
+ test('passed string is a lowercase', () => {
+ expect(isLowerCase('a3@$')).toBe(true)
+});
+ test('passed value is not a lowercase', () => {
+ expect(isLowerCase('A3@$')).toBe(false)
+});
diff --git a/test/isNull/isNull.test.js b/test/isNull/isNull.test.js
index 84ffdc594..feb99d1bc 100644
--- a/test/isNull/isNull.test.js
+++ b/test/isNull/isNull.test.js
@@ -5,6 +5,10 @@ const isNull = require('./isNull.js');
test('isNull is a Function', () => {
expect(isNull).toBeInstanceOf(Function);
});
- t.equal(isNull(null), true, "passed argument is a null");
- t.equal(isNull(NaN), false, "passed argument is a null");
+ test('passed argument is a null', () => {
+ expect(isNull(null)).toBe(true)
+});
+ test('passed argument is a null', () => {
+ expect(isNull(NaN)).toBe(false)
+});
diff --git a/test/isNumber/isNumber.test.js b/test/isNumber/isNumber.test.js
index 2211dd343..662876c51 100644
--- a/test/isNumber/isNumber.test.js
+++ b/test/isNumber/isNumber.test.js
@@ -5,6 +5,10 @@ const isNumber = require('./isNumber.js');
test('isNumber is a Function', () => {
expect(isNumber).toBeInstanceOf(Function);
});
- t.equal(isNumber(1), true, "passed argument is a number");
- t.equal(isNumber('1'), false, "passed argument is not a number");
+ test('passed argument is a number', () => {
+ expect(isNumber(1)).toBe(true)
+});
+ test('passed argument is not a number', () => {
+ expect(isNumber('1')).toBe(false)
+});
diff --git a/test/isPrime/isPrime.test.js b/test/isPrime/isPrime.test.js
index ded341837..1fd824ed7 100644
--- a/test/isPrime/isPrime.test.js
+++ b/test/isPrime/isPrime.test.js
@@ -5,5 +5,7 @@ const isPrime = require('./isPrime.js');
test('isPrime is a Function', () => {
expect(isPrime).toBeInstanceOf(Function);
});
- t.equal(isPrime(11), true, "passed number is a prime");
+ test('passed number is a prime', () => {
+ expect(isPrime(11)).toBe(true)
+});
diff --git a/test/isPrimitive/isPrimitive.test.js b/test/isPrimitive/isPrimitive.test.js
index edd290d1a..0083cd484 100644
--- a/test/isPrimitive/isPrimitive.test.js
+++ b/test/isPrimitive/isPrimitive.test.js
@@ -5,16 +5,36 @@ const isPrimitive = require('./isPrimitive.js');
test('isPrimitive is a Function', () => {
expect(isPrimitive).toBeInstanceOf(Function);
});
- t.true(isPrimitive(null), "isPrimitive(null) is primitive");
- t.true(isPrimitive(undefined), "isPrimitive(undefined) is primitive");
- t.true(isPrimitive('string'), "isPrimitive(string) is primitive");
- t.true(isPrimitive(true), "isPrimitive(true) is primitive");
- t.true(isPrimitive(50), "isPrimitive(50) is primitive");
- t.true(isPrimitive('Hello'), "isPrimitive('Hello') is primitive");
- t.true(isPrimitive(false), "isPrimitive(false) is primitive");
- t.true(isPrimitive(Symbol()), "isPrimitive(Symbol()) is primitive");
- t.false(isPrimitive([1, 2, 3]), "isPrimitive([1, 2, 3]) is not primitive");
- t.false(isPrimitive({ a: 123 }), "isPrimitive({ a: 123 }) is not primitive");
+ test('isPrimitive(null) is primitive', () => {
+ expect(isPrimitive(null)).toBeTruthy()
+});
+ test('isPrimitive(undefined) is primitive', () => {
+ expect(isPrimitive(undefined)).toBeTruthy()
+});
+ test('isPrimitive(string) is primitive', () => {
+ expect(isPrimitive('string')).toBeTruthy()
+});
+ test('isPrimitive(true) is primitive', () => {
+ expect(isPrimitive(true)).toBeTruthy()
+});
+ test('isPrimitive(50) is primitive', () => {
+ expect(isPrimitive(50)).toBeTruthy()
+});
+ test('isPrimitive('Hello') is primitive', () => {
+ expect(isPrimitive('Hello')).toBeTruthy()
+});
+ test('isPrimitive(false) is primitive', () => {
+ expect(isPrimitive(false)).toBeTruthy()
+});
+ test('isPrimitive(Symbol()) is primitive', () => {
+ expect(isPrimitive(Symbol())).toBeTruthy()
+});
+ test('isPrimitive([1, 2, 3]) is not primitive', () => {
+ expect(isPrimitive([1, 2, 3])).toBeFalsy()
+});
+ test('isPrimitive({ a: 123 }) is not primitive', () => {
+ expect(isPrimitive({ a: 123 })).toBeFalsy()
+});
let start = new Date().getTime();
isPrimitive({ a: 123
diff --git a/test/isSymbol/isSymbol.test.js b/test/isSymbol/isSymbol.test.js
index e779b9500..a0c2a5181 100644
--- a/test/isSymbol/isSymbol.test.js
+++ b/test/isSymbol/isSymbol.test.js
@@ -5,5 +5,7 @@ const isSymbol = require('./isSymbol.js');
test('isSymbol is a Function', () => {
expect(isSymbol).toBeInstanceOf(Function);
});
- t.equal(isSymbol(Symbol('x')), true, "Checks if the given argument is a symbol");
+ test('Checks if the given argument is a symbol', () => {
+ expect(isSymbol(Symbol('x'))).toBe(true)
+});
diff --git a/test/join/join.test.js b/test/join/join.test.js
index 4380658a2..834314e00 100644
--- a/test/join/join.test.js
+++ b/test/join/join.test.js
@@ -5,7 +5,13 @@ const join = require('./join.js');
test('join is a Function', () => {
expect(join).toBeInstanceOf(Function);
});
- t.deepEqual(join(['pen', 'pineapple', 'apple', 'pen'], ',', '&'), "pen,pineapple,apple&pen", "Joins all elements of an array into a string and returns this string");
- t.deepEqual(join(['pen', 'pineapple', 'apple', 'pen'], ','), "pen,pineapple,apple,pen", "Joins all elements of an array into a string and returns this string");
- t.deepEqual(join(['pen', 'pineapple', 'apple', 'pen']), "pen,pineapple,apple,pen", "Joins all elements of an array into a string and returns this string");
+ test('Joins all elements of an array into a string and returns this string', () => {
+ expect(join(['pen', 'pineapple', 'apple', 'pen'], ',', '&'), "pen,pineapple).toEqual(apple&pen")
+});
+ test('Joins all elements of an array into a string and returns this string', () => {
+ expect(join(['pen', 'pineapple', 'apple', 'pen'], ','), "pen,pineapple,apple).toEqual(pen")
+});
+ test('Joins all elements of an array into a string and returns this string', () => {
+ expect(join(['pen', 'pineapple', 'apple', 'pen']), "pen,pineapple,apple).toEqual(pen")
+});
diff --git a/test/last/last.test.js b/test/last/last.test.js
index 282177e82..ebc9c8281 100644
--- a/test/last/last.test.js
+++ b/test/last/last.test.js
@@ -8,7 +8,9 @@ const last = require('./last.js');
test('last({ a: 1234}) returns undefined', () => {
expect(last({ a: 1234}) === undefined).toBeTruthy();
});
- t.equal(last([1, 2, 3]), 3, "last([1, 2, 3]) returns 3");
+ test('last([1, 2, 3]) returns 3', () => {
+ expect(last([1, 2, 3])).toBe(3)
+});
test('last({ 0: false}) returns undefined', () => {
expect(last({ 0: false}), undefined).toBe()
});
diff --git a/test/lcm/lcm.test.js b/test/lcm/lcm.test.js
index cf85e5970..3decb409e 100644
--- a/test/lcm/lcm.test.js
+++ b/test/lcm/lcm.test.js
@@ -5,6 +5,10 @@ const lcm = require('./lcm.js');
test('lcm is a Function', () => {
expect(lcm).toBeInstanceOf(Function);
});
- t.equal(lcm(12, 7), 84, "Returns the least common multiple of two or more numbers.");
- t.equal(lcm(...[1, 3, 4, 5]), 60, "Returns the least common multiple of two or more numbers.");
+ test('Returns the least common multiple of two or more numbers.', () => {
+ expect(lcm(12, 7)).toBe(84)
+});
+ test('Returns the least common multiple of two or more numbers.', () => {
+ expect(lcm(...[1, 3, 4, 5])).toBe(60)
+});
diff --git a/test/longestItem/longestItem.test.js b/test/longestItem/longestItem.test.js
index 7d2b0b6e2..244babd22 100644
--- a/test/longestItem/longestItem.test.js
+++ b/test/longestItem/longestItem.test.js
@@ -5,5 +5,7 @@ const longestItem = require('./longestItem.js');
test('longestItem is a Function', () => {
expect(longestItem).toBeInstanceOf(Function);
});
- t.deepEqual(longestItem('this', 'is', 'a', 'testcase'), 'testcase', "Returns the longest object");
+ test('Returns the longest object', () => {
+ expect(longestItem('this', 'is', 'a', 'testcase')).toEqual('testcase')
+});
diff --git a/test/luhnCheck/luhnCheck.test.js b/test/luhnCheck/luhnCheck.test.js
index 7c1647865..938060e89 100644
--- a/test/luhnCheck/luhnCheck.test.js
+++ b/test/luhnCheck/luhnCheck.test.js
@@ -5,7 +5,13 @@ const luhnCheck = require('./luhnCheck.js');
test('luhnCheck is a Function', () => {
expect(luhnCheck).toBeInstanceOf(Function);
});
- t.equal(luhnCheck(6011329933655299), false, "validates identification number");
- t.equal(luhnCheck('4485275742308327'), true, "validates identification number");
- t.equal(luhnCheck(123456789), false, "validates identification number");
+ test('validates identification number', () => {
+ expect(luhnCheck(6011329933655299)).toBe(false)
+});
+ test('validates identification number', () => {
+ expect(luhnCheck('4485275742308327')).toBe(true)
+});
+ test('validates identification number', () => {
+ expect(luhnCheck(123456789)).toBe(false)
+});
diff --git a/test/mapObject/mapObject.test.js b/test/mapObject/mapObject.test.js
index 2b00337b8..ea3d2fd08 100644
--- a/test/mapObject/mapObject.test.js
+++ b/test/mapObject/mapObject.test.js
@@ -5,7 +5,9 @@ const mapObject = require('./mapObject.js');
test('mapObject is a Function', () => {
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 }");
+ test('mapObject([1, 2, 3], a => a * a) returns { 1: 1, 2: 4, 3: 9 }', () => {
+ expect(mapObject([1, 2, 3], a => a * a), { 1: 1, 2: 4).toEqual(3: 9 })
+});
test('mapObject([1, 2, 3, 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()
});
diff --git a/test/mask/mask.test.js b/test/mask/mask.test.js
index ca1fab4ab..16a590dd5 100644
--- a/test/mask/mask.test.js
+++ b/test/mask/mask.test.js
@@ -5,7 +5,13 @@ const mask = require('./mask.js');
test('mask is a Function', () => {
expect(mask).toBeInstanceOf(Function);
});
- t.equal(mask(1234567890), '******7890', "Replaces all but the last num of characters with the specified mask character");
- t.equal(mask(1234567890, 3), '*******890', "Replaces all but the last num of characters with the specified mask character");
- t.equal(mask(1234567890, -4, '$'), '$$$$567890', "Replaces all but the last num of characters with the specified mask character");
+ test('Replaces all but the last num of characters with the specified mask character', () => {
+ expect(mask(1234567890)).toBe('******7890')
+});
+ test('Replaces all but the last num of characters with the specified mask character', () => {
+ expect(mask(1234567890, 3)).toBe('*******890')
+});
+ test('Replaces all but the last num of characters with the specified mask character', () => {
+ expect(mask(1234567890, -4, '$')).toBe('$$$$567890')
+});
diff --git a/test/maxN/maxN.test.js b/test/maxN/maxN.test.js
index aaad1b7c3..ca4af723c 100644
--- a/test/maxN/maxN.test.js
+++ b/test/maxN/maxN.test.js
@@ -5,6 +5,10 @@ const maxN = require('./maxN.js');
test('maxN is a Function', () => {
expect(maxN).toBeInstanceOf(Function);
});
- t.deepEqual(maxN([1, 2, 3]), [3], "Returns the n maximum elements from the provided array");
- t.deepEqual(maxN([1, 2, 3], 2), [3, 2], "Returns the n maximum elements from the provided array");
+ test('Returns the n maximum elements from the provided array', () => {
+ expect(maxN([1, 2, 3])).toEqual([3])
+});
+ test('Returns the n maximum elements from the provided array', () => {
+ expect(maxN([1, 2, 3], 2), [3).toEqual(2])
+});
diff --git a/test/median/median.test.js b/test/median/median.test.js
index da38d46cc..0d330d0f0 100644
--- a/test/median/median.test.js
+++ b/test/median/median.test.js
@@ -5,6 +5,10 @@ const median = require('./median.js');
test('median is a Function', () => {
expect(median).toBeInstanceOf(Function);
});
- t.equal(median([5, 6, 50, 1, -5]), 5, "Returns the median of an array of numbers");
- t.equal(median([1, 2, 3]), 2, "Returns the median of an array of numbers");
+ test('Returns the median of an array of numbers', () => {
+ expect(median([5, 6, 50, 1, -5])).toBe(5)
+});
+ test('Returns the median of an array of numbers', () => {
+ expect(median([1, 2, 3])).toBe(2)
+});
diff --git a/test/minN/minN.test.js b/test/minN/minN.test.js
index 5f171662d..2475ac45b 100644
--- a/test/minN/minN.test.js
+++ b/test/minN/minN.test.js
@@ -5,6 +5,10 @@ const minN = require('./minN.js');
test('minN is a Function', () => {
expect(minN).toBeInstanceOf(Function);
});
- t.deepEqual(minN([1, 2, 3]), [1], "Returns the n minimum elements from the provided array");
- t.deepEqual(minN([1, 2, 3], 2), [1, 2], "Returns the n minimum elements from the provided array");
+ test('Returns the n minimum elements from the provided array', () => {
+ expect(minN([1, 2, 3])).toEqual([1])
+});
+ test('Returns the n minimum elements from the provided array', () => {
+ expect(minN([1, 2, 3], 2), [1).toEqual(2])
+});
diff --git a/test/negate/negate.test.js b/test/negate/negate.test.js
index 1787751a9..8166c7634 100644
--- a/test/negate/negate.test.js
+++ b/test/negate/negate.test.js
@@ -5,6 +5,8 @@ const negate = require('./negate.js');
test('negate is a Function', () => {
expect(negate).toBeInstanceOf(Function);
});
- t.deepEqual([1, 2, 3, 4, 5, 6].filter(negate(n => n % 2 === 0)), [1, 3, 5], "Negates a predicate function");
+ test('Negates a predicate function', () => {
+ expect([1, 2, 3, 4, 5, 6].filter(negate(n => n % 2 === 0)), [1, 3).toEqual(5])
+});
diff --git a/test/nthElement/nthElement.test.js b/test/nthElement/nthElement.test.js
index 4a0f701b5..67bde724d 100644
--- a/test/nthElement/nthElement.test.js
+++ b/test/nthElement/nthElement.test.js
@@ -5,6 +5,10 @@ const nthElement = require('./nthElement.js');
test('nthElement is a Function', () => {
expect(nthElement).toBeInstanceOf(Function);
});
- t.equal(nthElement(['a', 'b', 'c'], 1), 'b', "Returns the nth element of an array.");
- t.equal(nthElement(['a', 'b', 'c'], -3), 'a', "Returns the nth element of an array.");
+ test('Returns the nth element of an array.', () => {
+ expect(nthElement(['a', 'b', 'c'], 1)).toBe('b')
+});
+ test('Returns the nth element of an array.', () => {
+ expect(nthElement(['a', 'b', 'c'], -3)).toBe('a')
+});
diff --git a/test/objectFromPairs/objectFromPairs.test.js b/test/objectFromPairs/objectFromPairs.test.js
index f158cd137..a4cb21be0 100644
--- a/test/objectFromPairs/objectFromPairs.test.js
+++ b/test/objectFromPairs/objectFromPairs.test.js
@@ -5,5 +5,7 @@ const objectFromPairs = require('./objectFromPairs.js');
test('objectFromPairs is a Function', () => {
expect(objectFromPairs).toBeInstanceOf(Function);
});
- t.deepEqual(objectFromPairs([['a', 1], ['b', 2]]), {a: 1, b: 2}, "Creates an object from the given key-value pairs.");
+ test('Creates an object from the given key-value pairs.', () => {
+ expect(objectFromPairs([['a', 1], ['b', 2]]), {a: 1).toEqual(b: 2})
+});
diff --git a/test/objectToPairs/objectToPairs.test.js b/test/objectToPairs/objectToPairs.test.js
index cc7b858d5..5937a1ae7 100644
--- a/test/objectToPairs/objectToPairs.test.js
+++ b/test/objectToPairs/objectToPairs.test.js
@@ -5,5 +5,7 @@ const objectToPairs = require('./objectToPairs.js');
test('objectToPairs is a Function', () => {
expect(objectToPairs).toBeInstanceOf(Function);
});
- t.deepEqual(objectToPairs({ a: 1, b: 2 }), [['a',1],['b',2]], "Creates an array of key-value pair arrays from an object.");
+ test('Creates an array of key-value pair arrays from an object.', () => {
+ expect(objectToPairs({ a: 1, b: 2 }), [['a',1],['b').toEqual(2]])
+});
diff --git a/test/orderBy/orderBy.test.js b/test/orderBy/orderBy.test.js
index 82cc69fe2..c5283fed5 100644
--- a/test/orderBy/orderBy.test.js
+++ b/test/orderBy/orderBy.test.js
@@ -6,6 +6,10 @@ const orderBy = require('./orderBy.js');
expect(orderBy).toBeInstanceOf(Function);
});
const users = [{ name: 'fred', age: 48 }, { name: 'barney', age: 36 }, { name: 'fred', age: 40 }];
- t.deepEqual(orderBy(users, ['name', 'age'], ['asc', 'desc']), [{name: 'barney', age: 36}, {name: 'fred', age: 48}, {name: 'fred', age: 40}], "Returns a sorted array of objects ordered by properties and orders.");
- t.deepEqual(orderBy(users, ['name', 'age']), [{name: 'barney', age: 36}, {name: 'fred', age: 40}, {name: 'fred', age: 48}], "Returns a sorted array of objects ordered by properties and orders.");
+ test('Returns a sorted array of objects ordered by properties and orders.', () => {
+ expect(orderBy(users, ['name', 'age'], ['asc', 'desc']), [{name: 'barney', age: 36}, {name: 'fred', age: 48}, {name: 'fred').toEqual(age: 40}])
+});
+ test('Returns a sorted array of objects ordered by properties and orders.', () => {
+ expect(orderBy(users, ['name', 'age']), [{name: 'barney', age: 36}, {name: 'fred', age: 40}, {name: 'fred').toEqual(age: 48}])
+});
diff --git a/test/palindrome/palindrome.test.js b/test/palindrome/palindrome.test.js
index 559ea76b4..1ae5482bd 100644
--- a/test/palindrome/palindrome.test.js
+++ b/test/palindrome/palindrome.test.js
@@ -5,6 +5,10 @@ const palindrome = require('./palindrome.js');
test('palindrome is a Function', () => {
expect(palindrome).toBeInstanceOf(Function);
});
- t.equal(palindrome('taco cat'), true, "Given string is a palindrome");
- t.equal(palindrome('foobar'), false, "Given string is not a palindrome");
+ test('Given string is a palindrome', () => {
+ expect(palindrome('taco cat')).toBe(true)
+});
+ test('Given string is not a palindrome', () => {
+ expect(palindrome('foobar')).toBe(false)
+});
diff --git a/test/partition/partition.test.js b/test/partition/partition.test.js
index 958a9786d..9e78206c2 100644
--- a/test/partition/partition.test.js
+++ b/test/partition/partition.test.js
@@ -6,5 +6,7 @@ const partition = require('./partition.js');
expect(partition).toBeInstanceOf(Function);
});
const users = [{ user: 'barney', age: 36, active: false }, { user: 'fred', age: 40, active: true }];
- t.deepEqual(partition(users, o => o.active), [[{ 'user': 'fred', 'age': 40, 'active': true }],[{ 'user': 'barney', 'age': 36, 'active': false }]], "Groups the elements into two arrays, depending on the provided function's truthiness for each element.");
+ test('Groups the elements into two arrays, depending on the provided function's truthiness for each element.', () => {
+ expect(partition(users, o => o.active), [[{ 'user': 'fred', 'age': 40, 'active': true }],[{ 'user': 'barney', 'age': 36).toEqual('active': false }]])
+});
diff --git a/test/percentile/percentile.test.js b/test/percentile/percentile.test.js
index b3288143c..6d5a8b8ec 100644
--- a/test/percentile/percentile.test.js
+++ b/test/percentile/percentile.test.js
@@ -5,5 +5,7 @@ const percentile = require('./percentile.js');
test('percentile is a Function', () => {
expect(percentile).toBeInstanceOf(Function);
});
- t.equal(percentile([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 6), 55, "Uses the percentile formula to calculate how many numbers in the given array are less or equal to the given value.");
+ test('Uses the percentile formula to calculate how many numbers in the given array are less or equal to the given value.', () => {
+ expect(percentile([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 6)).toBe(55)
+});
diff --git a/test/pick/pick.test.js b/test/pick/pick.test.js
index 418f48d2d..f2bf03f98 100644
--- a/test/pick/pick.test.js
+++ b/test/pick/pick.test.js
@@ -5,5 +5,7 @@ const pick = require('./pick.js');
test('pick is a Function', () => {
expect(pick).toBeInstanceOf(Function);
});
- t.deepEqual(pick({ a: 1, b: '2', c: 3 }, ['a', 'c']), { 'a': 1, 'c': 3 }, "Picks the key-value pairs corresponding to the given keys from an object.");
+ test('Picks the key-value pairs corresponding to the given keys from an object.', () => {
+ expect(pick({ a: 1, b: '2', c: 3 }, ['a', 'c']), { 'a': 1).toEqual('c': 3 })
+});
diff --git a/test/powerset/powerset.test.js b/test/powerset/powerset.test.js
index 355d18110..0e90083a5 100644
--- a/test/powerset/powerset.test.js
+++ b/test/powerset/powerset.test.js
@@ -5,5 +5,7 @@ const powerset = require('./powerset.js');
test('powerset is a Function', () => {
expect(powerset).toBeInstanceOf(Function);
});
- t.deepEqual(powerset([1, 2]), [[], [1], [2], [2,1]], "Returns the powerset of a given array of numbers.");
+ test('Returns the powerset of a given array of numbers.', () => {
+ expect(powerset([1, 2]), [[], [1], [2], [2).toEqual(1]])
+});
diff --git a/test/prettyBytes/prettyBytes.test.js b/test/prettyBytes/prettyBytes.test.js
index 44e629b2d..4c6ede865 100644
--- a/test/prettyBytes/prettyBytes.test.js
+++ b/test/prettyBytes/prettyBytes.test.js
@@ -5,7 +5,13 @@ const prettyBytes = require('./prettyBytes.js');
test('prettyBytes is a Function', () => {
expect(prettyBytes).toBeInstanceOf(Function);
});
- t.equal(prettyBytes(1000), '1 KB', "Converts a number in bytes to a human-readable string.");
- t.equal(prettyBytes(-27145424323.5821, 5), '-27.145 GB', "Converts a number in bytes to a human-readable string.");
- t.equal(prettyBytes(123456789, 3, false), '123MB', "Converts a number in bytes to a human-readable string.");
+ test('Converts a number in bytes to a human-readable string.', () => {
+ expect(prettyBytes(1000)).toBe('1 KB')
+});
+ test('Converts a number in bytes to a human-readable string.', () => {
+ expect(prettyBytes(-27145424323.5821, 5)).toBe('-27.145 GB')
+});
+ test('Converts a number in bytes to a human-readable string.', () => {
+ expect(prettyBytes(123456789, 3, false)).toBe('123MB')
+});
diff --git a/test/primes/primes.test.js b/test/primes/primes.test.js
index bc302c481..20ceb463f 100644
--- a/test/primes/primes.test.js
+++ b/test/primes/primes.test.js
@@ -5,5 +5,7 @@ const primes = require('./primes.js');
test('primes is a Function', () => {
expect(primes).toBeInstanceOf(Function);
});
- t.deepEqual(primes(10), [2, 3, 5, 7], "Generates primes up to a given number, using the Sieve of Eratosthenes.");
+ test('Generates primes up to a given number, using the Sieve of Eratosthenes.', () => {
+ expect(primes(10), [2, 3, 5).toEqual(7])
+});
diff --git a/test/reducedFilter/reducedFilter.test.js b/test/reducedFilter/reducedFilter.test.js
index 5fce9e4cb..4d661d7c9 100644
--- a/test/reducedFilter/reducedFilter.test.js
+++ b/test/reducedFilter/reducedFilter.test.js
@@ -17,5 +17,7 @@ const reducedFilter = require('./reducedFilter.js');
age: 50
}
];
- t.deepEqual(reducedFilter(data, ['id', 'name'], item => item.age > 24), [{ id: 2, name: 'mike'}], "Filter an array of objects based on a condition while also filtering out unspecified keys.");
+ test('Filter an array of objects based on a condition while also filtering out unspecified keys.', () => {
+ expect(reducedFilter(data, ['id', 'name'], item => item.age > 24), [{ id: 2).toEqual(name: 'mike'}])
+});
diff --git a/test/remove/remove.test.js b/test/remove/remove.test.js
index bae377e4e..8b94f0aaf 100644
--- a/test/remove/remove.test.js
+++ b/test/remove/remove.test.js
@@ -5,6 +5,8 @@ const remove = require('./remove.js');
test('remove is a Function', () => {
expect(remove).toBeInstanceOf(Function);
});
- t.deepEqual(remove([1, 2, 3, 4], n => n % 2 === 0), [2, 4], "Removes elements from an array for which the given function returns false");
+ test('Removes elements from an array for which the given function returns false', () => {
+ expect(remove([1, 2, 3, 4], n => n % 2 === 0), [2).toEqual(4])
+});
diff --git a/test/reverseString/reverseString.test.js b/test/reverseString/reverseString.test.js
index 176f122c1..08b76cbaf 100644
--- a/test/reverseString/reverseString.test.js
+++ b/test/reverseString/reverseString.test.js
@@ -5,5 +5,7 @@ const reverseString = require('./reverseString.js');
test('reverseString is a Function', () => {
expect(reverseString).toBeInstanceOf(Function);
});
- t.equal(reverseString('foobar'), 'raboof', "Reverses a string.");
+ test('Reverses a string.', () => {
+ expect(reverseString('foobar')).toBe('raboof')
+});
diff --git a/test/round/round.test.js b/test/round/round.test.js
index 8d9cc9318..dd4c5f59f 100644
--- a/test/round/round.test.js
+++ b/test/round/round.test.js
@@ -5,10 +5,18 @@ const round = require('./round.js');
test('round is a Function', () => {
expect(round).toBeInstanceOf(Function);
});
- t.equal(round(1.005, 2), 1.01, "round(1.005, 2) returns 1.01");
- t.equal(round(123.3423345345345345344, 11), 123.34233453453, "round(123.3423345345345345344, 11) returns 123.34233453453");
- t.equal(round(3.342, 11), 3.342, "round(3.342, 11) returns 3.342");
- t.equal(round(1.005), 1, "round(1.005) returns 1");
+ test('round(1.005, 2) returns 1.01', () => {
+ expect(round(1.005, 2)).toBe(1.01)
+});
+ test('round(123.3423345345345345344, 11) returns 123.34233453453', () => {
+ expect(round(123.3423345345345345344, 11)).toBe(123.34233453453)
+});
+ test('round(3.342, 11) returns 3.342', () => {
+ expect(round(3.342, 11)).toBe(3.342)
+});
+ test('round(1.005) returns 1', () => {
+ expect(round(1.005)).toBe(1)
+});
test('round([1.005, 2]) returns NaN', () => {
expect(isNaN(round([1.005, 2]))).toBeTruthy();
});
diff --git a/test/sdbm/sdbm.test.js b/test/sdbm/sdbm.test.js
index 718fd716a..3b1156ed2 100644
--- a/test/sdbm/sdbm.test.js
+++ b/test/sdbm/sdbm.test.js
@@ -5,5 +5,7 @@ const sdbm = require('./sdbm.js');
test('sdbm is a Function', () => {
expect(sdbm).toBeInstanceOf(Function);
});
- t.equal(sdbm('name'), -3521204949, "Hashes the input string into a whole number.");
+ test('Hashes the input string into a whole number.', () => {
+ expect(sdbm('name')).toBe(-3521204949)
+});
diff --git a/test/similarity/similarity.test.js b/test/similarity/similarity.test.js
index 480cba7b3..c737f6a4b 100644
--- a/test/similarity/similarity.test.js
+++ b/test/similarity/similarity.test.js
@@ -5,5 +5,7 @@ const similarity = require('./similarity.js');
test('similarity is a Function', () => {
expect(similarity).toBeInstanceOf(Function);
});
- t.deepEqual(similarity([1, 2, 3], [1, 2, 4]), [1, 2], "Returns an array of elements that appear in both arrays.");
+ test('Returns an array of elements that appear in both arrays.', () => {
+ expect(similarity([1, 2, 3], [1, 2, 4]), [1).toEqual(2])
+});
diff --git a/test/size/size.test.js b/test/size/size.test.js
index f47849756..cb48c5517 100644
--- a/test/size/size.test.js
+++ b/test/size/size.test.js
@@ -5,6 +5,10 @@ const size = require('./size.js');
test('size is a Function', () => {
expect(size).toBeInstanceOf(Function);
});
- t.equal(size([1, 2, 3, 4, 5]), 5, "Get size of arrays, objects or strings.");
- t.equal(size({ one: 1, two: 2, three: 3 }), 3, "Get size of arrays, objects or strings.");
+ test('Get size of arrays, objects or strings.', () => {
+ expect(size([1, 2, 3, 4, 5])).toBe(5)
+});
+ test('Get size of arrays, objects or strings.', () => {
+ expect(size({ one: 1, two: 2, three: 3 })).toBe(3)
+});
diff --git a/test/sortCharactersInString/sortCharactersInString.test.js b/test/sortCharactersInString/sortCharactersInString.test.js
index 92a055f4d..00084521f 100644
--- a/test/sortCharactersInString/sortCharactersInString.test.js
+++ b/test/sortCharactersInString/sortCharactersInString.test.js
@@ -5,5 +5,7 @@ const sortCharactersInString = require('./sortCharactersInString.js');
test('sortCharactersInString is a Function', () => {
expect(sortCharactersInString).toBeInstanceOf(Function);
});
- t.equal(sortCharactersInString('cabbage'), 'aabbceg', "Alphabetically sorts the characters in a string.");
+ test('Alphabetically sorts the characters in a string.', () => {
+ expect(sortCharactersInString('cabbage')).toBe('aabbceg')
+});
diff --git a/test/sortedIndex/sortedIndex.test.js b/test/sortedIndex/sortedIndex.test.js
index 903b2534f..bdf1500b8 100644
--- a/test/sortedIndex/sortedIndex.test.js
+++ b/test/sortedIndex/sortedIndex.test.js
@@ -5,6 +5,10 @@ const sortedIndex = require('./sortedIndex.js');
test('sortedIndex is a Function', () => {
expect(sortedIndex).toBeInstanceOf(Function);
});
- t.equal(sortedIndex([5, 3, 2, 1], 4), 1, "Returns the lowest index at which value should be inserted into array in order to maintain its sort order.");
- t.equal(sortedIndex([30, 50], 40), 1, "Returns the lowest index at which value should be inserted into array in order to maintain its sort order.");
+ test('Returns the lowest index at which value should be inserted into array in order to maintain its sort order.', () => {
+ expect(sortedIndex([5, 3, 2, 1], 4)).toBe(1)
+});
+ test('Returns the lowest index at which value should be inserted into array in order to maintain its sort order.', () => {
+ expect(sortedIndex([30, 50], 40)).toBe(1)
+});
diff --git a/test/splitLines/splitLines.test.js b/test/splitLines/splitLines.test.js
index fcbc7d46a..a73d52de9 100644
--- a/test/splitLines/splitLines.test.js
+++ b/test/splitLines/splitLines.test.js
@@ -5,5 +5,7 @@ const splitLines = require('./splitLines.js');
test('splitLines is a Function', () => {
expect(splitLines).toBeInstanceOf(Function);
});
- t.deepEqual(splitLines('This\nis a\nmultiline\nstring.\n'), ['This', 'is a', 'multiline', 'string.' , ''], "Splits a multiline string into an array of lines.");
+ test('Splits a multiline string into an array of lines.', () => {
+ expect(splitLines('This\nis a\nmultiline\nstring.\n'), ['This', 'is a', 'multiline', 'string.' ).toEqual(''])
+});
diff --git a/test/spreadOver/spreadOver.test.js b/test/spreadOver/spreadOver.test.js
index df422d8c2..79c471dca 100644
--- a/test/spreadOver/spreadOver.test.js
+++ b/test/spreadOver/spreadOver.test.js
@@ -6,5 +6,7 @@ const spreadOver = require('./spreadOver.js');
expect(spreadOver).toBeInstanceOf(Function);
});
const arrayMax = spreadOver(Math.max);
- t.equal(arrayMax([1, 2, 3]), 3, "Takes a variadic function and returns a closure that accepts an array of arguments to map to the inputs of the function.");
+ test('Takes a variadic function and returns a closure that accepts an array of arguments to map to the inputs of the function.', () => {
+ expect(arrayMax([1, 2, 3])).toBe(3)
+});
diff --git a/test/standardDeviation/standardDeviation.test.js b/test/standardDeviation/standardDeviation.test.js
index 9ddfb23d0..431ce662a 100644
--- a/test/standardDeviation/standardDeviation.test.js
+++ b/test/standardDeviation/standardDeviation.test.js
@@ -5,6 +5,10 @@ const standardDeviation = require('./standardDeviation.js');
test('standardDeviation is a Function', () => {
expect(standardDeviation).toBeInstanceOf(Function);
});
- t.equal(standardDeviation([10, 2, 38, 23, 38, 23, 21]), 13.284434142114991, "Returns the standard deviation of an array of numbers");
- t.equal(standardDeviation([10, 2, 38, 23, 38, 23, 21], true), 12.29899614287479, "Returns the standard deviation of an array of numbers");
+ test('Returns the standard deviation of an array of numbers', () => {
+ expect(standardDeviation([10, 2, 38, 23, 38, 23, 21])).toBe(13.284434142114991)
+});
+ test('Returns the standard deviation of an array of numbers', () => {
+ expect(standardDeviation([10, 2, 38, 23, 38, 23, 21], true)).toBe(12.29899614287479)
+});
diff --git a/test/stringPermutations/stringPermutations.test.js b/test/stringPermutations/stringPermutations.test.js
index a99fb7b23..54bfb0729 100644
--- a/test/stringPermutations/stringPermutations.test.js
+++ b/test/stringPermutations/stringPermutations.test.js
@@ -5,8 +5,14 @@ const stringPermutations = require('./stringPermutations.js');
test('stringPermutations is a Function', () => {
expect(stringPermutations).toBeInstanceOf(Function);
});
- t.deepEqual(stringPermutations('abc'), ['abc','acb','bac','bca','cab','cba'], "Generates all stringPermutations of a string");
- t.deepEqual(stringPermutations('a'), ['a'], "Works for single-letter strings");
- t.deepEqual(stringPermutations(''), [''], "Works for empty strings");
+ test('Generates all stringPermutations of a string', () => {
+ expect(stringPermutations('abc'), ['abc','acb','bac','bca','cab').toEqual('cba'])
+});
+ test('Works for single-letter strings', () => {
+ expect(stringPermutations('a')).toEqual(['a'])
+});
+ test('Works for empty strings', () => {
+ expect(stringPermutations('')).toEqual([''])
+});
diff --git a/test/sum/sum.test.js b/test/sum/sum.test.js
index ed21ad02f..ba1ba0785 100644
--- a/test/sum/sum.test.js
+++ b/test/sum/sum.test.js
@@ -5,5 +5,7 @@ const sum = require('./sum.js');
test('sum is a Function', () => {
expect(sum).toBeInstanceOf(Function);
});
- t.equal(sum(...[1, 2, 3, 4]), 10, "Returns the sum of two or more numbers/arrays.");
+ test('Returns the sum of two or more numbers/arrays.', () => {
+ expect(sum(...[1, 2, 3, 4])).toBe(10)
+});
diff --git a/test/sumPower/sumPower.test.js b/test/sumPower/sumPower.test.js
index 17f5a1433..aee0cf0a2 100644
--- a/test/sumPower/sumPower.test.js
+++ b/test/sumPower/sumPower.test.js
@@ -5,7 +5,13 @@ const sumPower = require('./sumPower.js');
test('sumPower is a Function', () => {
expect(sumPower).toBeInstanceOf(Function);
});
- t.equal(sumPower(10), 385, "Returns the sum of the powers of all the numbers from start to end");
- t.equal(sumPower(10, 3), 3025, "Returns the sum of the powers of all the numbers from start to end");
- t.equal(sumPower(10, 3, 5), 2925, "Returns the sum of the powers of all the numbers from start to end");
+ test('Returns the sum of the powers of all the numbers from start to end', () => {
+ expect(sumPower(10)).toBe(385)
+});
+ test('Returns the sum of the powers of all the numbers from start to end', () => {
+ expect(sumPower(10, 3)).toBe(3025)
+});
+ test('Returns the sum of the powers of all the numbers from start to end', () => {
+ expect(sumPower(10, 3, 5)).toBe(2925)
+});
diff --git a/test/symmetricDifference/symmetricDifference.test.js b/test/symmetricDifference/symmetricDifference.test.js
index 4874b7544..4084a5a1d 100644
--- a/test/symmetricDifference/symmetricDifference.test.js
+++ b/test/symmetricDifference/symmetricDifference.test.js
@@ -5,5 +5,7 @@ const symmetricDifference = require('./symmetricDifference.js');
test('symmetricDifference is a Function', () => {
expect(symmetricDifference).toBeInstanceOf(Function);
});
- t.deepEqual(symmetricDifference([1, 2, 3], [1, 2, 4]), [3, 4], "Returns the symmetric difference between two arrays.");
+ test('Returns the symmetric difference between two arrays.', () => {
+ expect(symmetricDifference([1, 2, 3], [1, 2, 4]), [3).toEqual(4])
+});
diff --git a/test/tail/tail.test.js b/test/tail/tail.test.js
index df77407cf..8c8460f64 100644
--- a/test/tail/tail.test.js
+++ b/test/tail/tail.test.js
@@ -5,6 +5,10 @@ const tail = require('./tail.js');
test('tail is a Function', () => {
expect(tail).toBeInstanceOf(Function);
});
- t.deepEqual(tail([1, 2, 3]), [2, 3], "Returns tail");
- t.deepEqual(tail([1]), [1], "Returns tail");
+ test('Returns tail', () => {
+ expect(tail([1, 2, 3]), [2).toEqual(3])
+});
+ test('Returns tail', () => {
+ expect(tail([1])).toEqual([1])
+});
diff --git a/test/take/take.test.js b/test/take/take.test.js
index 2a71a1476..877c1e64b 100644
--- a/test/take/take.test.js
+++ b/test/take/take.test.js
@@ -5,7 +5,11 @@ const take = require('./take.js');
test('take is a Function', () => {
expect(take).toBeInstanceOf(Function);
});
- t.deepEqual(take([1, 2, 3], 5), [1, 2, 3], "Returns an array with n elements removed from the beginning.");
- t.deepEqual(take([1, 2, 3], 0), [], "Returns an array with n elements removed from the beginning.");
+ test('Returns an array with n elements removed from the beginning.', () => {
+ expect(take([1, 2, 3], 5), [1, 2).toEqual(3])
+});
+ test('Returns an array with n elements removed from the beginning.', () => {
+ expect(take([1, 2, 3], 0)).toEqual([])
+});
diff --git a/test/takeRight/takeRight.test.js b/test/takeRight/takeRight.test.js
index ae144bb02..e82d8805c 100644
--- a/test/takeRight/takeRight.test.js
+++ b/test/takeRight/takeRight.test.js
@@ -5,6 +5,10 @@ const takeRight = require('./takeRight.js');
test('takeRight is a Function', () => {
expect(takeRight).toBeInstanceOf(Function);
});
- t.deepEqual(takeRight([1, 2, 3], 2), [2, 3], "Returns an array with n elements removed from the end");
- t.deepEqual(takeRight([1, 2, 3]), [3], "Returns an array with n elements removed from the end");
+ test('Returns an array with n elements removed from the end', () => {
+ expect(takeRight([1, 2, 3], 2), [2).toEqual(3])
+});
+ test('Returns an array with n elements removed from the end', () => {
+ expect(takeRight([1, 2, 3])).toEqual([3])
+});
diff --git a/test/toCamelCase/toCamelCase.test.js b/test/toCamelCase/toCamelCase.test.js
index 5577464d9..46b8caa2c 100644
--- a/test/toCamelCase/toCamelCase.test.js
+++ b/test/toCamelCase/toCamelCase.test.js
@@ -5,10 +5,18 @@ const toCamelCase = require('./toCamelCase.js');
test('toCamelCase is a Function', () => {
expect(toCamelCase).toBeInstanceOf(Function);
});
- t.equal(toCamelCase('some_database_field_name'), 'someDatabaseFieldName', "toCamelCase('some_database_field_name') returns someDatabaseFieldName");
- t.equal(toCamelCase('Some label that needs to be camelized'), 'someLabelThatNeedsToBeCamelized', "toCamelCase('Some label that needs to be camelized') returns someLabelThatNeedsToBeCamelized");
- t.equal(toCamelCase('some-javascript-property'), 'someJavascriptProperty', "toCamelCase('some-javascript-property') return someJavascriptProperty");
- t.equal(toCamelCase('some-mixed_string with spaces_underscores-and-hyphens'), 'someMixedStringWithSpacesUnderscoresAndHyphens', "toCamelCase('some-mixed_string with spaces_underscores-and-hyphens') returns someMixedStringWithSpacesUnderscoresAndHyphens");
+ test('toCamelCase('some_database_field_name') returns someDatabaseFieldName', () => {
+ expect(toCamelCase('some_database_field_name')).toBe('someDatabaseFieldName')
+});
+ test('toCamelCase('Some label that needs to be camelized') returns someLabelThatNeedsToBeCamelized', () => {
+ expect(toCamelCase('Some label that needs to be camelized')).toBe('someLabelThatNeedsToBeCamelized')
+});
+ test('toCamelCase('some-javascript-property') return someJavascriptProperty', () => {
+ expect(toCamelCase('some-javascript-property')).toBe('someJavascriptProperty')
+});
+ test('toCamelCase('some-mixed_string with spaces_underscores-and-hyphens') returns someMixedStringWithSpacesUnderscoresAndHyphens', () => {
+ expect(toCamelCase('some-mixed_string with spaces_underscores-and-hyphens')).toBe('someMixedStringWithSpacesUnderscoresAndHyphens')
+});
t.throws(() => toCamelCase(), 'toCamelCase() throws a error');
t.throws(() => toCamelCase([]), 'toCamelCase([]) throws a error');
t.throws(() => toCamelCase({}), 'toCamelCase({}) throws a error');
diff --git a/test/toDecimalMark/toDecimalMark.test.js b/test/toDecimalMark/toDecimalMark.test.js
index c35a4ade8..05c4574de 100644
--- a/test/toDecimalMark/toDecimalMark.test.js
+++ b/test/toDecimalMark/toDecimalMark.test.js
@@ -5,5 +5,7 @@ const toDecimalMark = require('./toDecimalMark.js');
test('toDecimalMark is a Function', () => {
expect(toDecimalMark).toBeInstanceOf(Function);
});
- t.equal(toDecimalMark(12305030388.9087), "12,305,030,388.909", "convert a float-point arithmetic to the Decimal mark form");
+ test('convert a float-point arithmetic to the Decimal mark form', () => {
+ expect(toDecimalMark(12305030388.9087), "12,305,030).toBe(388.909")
+});
diff --git a/test/toKebabCase/toKebabCase.test.js b/test/toKebabCase/toKebabCase.test.js
index 32e9d81d6..d59756ca0 100644
--- a/test/toKebabCase/toKebabCase.test.js
+++ b/test/toKebabCase/toKebabCase.test.js
@@ -5,10 +5,18 @@ const toKebabCase = require('./toKebabCase.js');
test('toKebabCase is a Function', () => {
expect(toKebabCase).toBeInstanceOf(Function);
});
- t.equal(toKebabCase('camelCase'), 'camel-case', "toKebabCase('camelCase') returns camel-case");
- 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");
+ test('toKebabCase('camelCase') returns camel-case', () => {
+ expect(toKebabCase('camelCase')).toBe('camel-case')
+});
+ test('toKebabCase('some text') returns some-text', () => {
+ expect(toKebabCase('some text')).toBe('some-text')
+});
+ test('toKebabCase('some-mixed-string With spaces-underscores-and-hyphens') returns some-mixed-string-with-spaces-underscores-and-hyphens', () => {
+ expect(toKebabCase('some-mixed-string With spaces-underscores-and-hyphens')).toBe('some-mixed-string-with-spaces-underscores-and-hyphens')
+});
+ test('toKebabCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML') returns i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html', () => {
+ expect(toKebabCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML')).toBe('i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html')
+});
test('toKebabCase() return undefined', () => {
expect(toKebabCase(), undefined).toBe()
});
diff --git a/test/toSafeInteger/toSafeInteger.test.js b/test/toSafeInteger/toSafeInteger.test.js
index 2676a9b09..49abc7547 100644
--- a/test/toSafeInteger/toSafeInteger.test.js
+++ b/test/toSafeInteger/toSafeInteger.test.js
@@ -8,15 +8,33 @@ const toSafeInteger = require('./toSafeInteger.js');
test('Number(toSafeInteger(3.2)) is a number', () => {
expect(Number(toSafeInteger(3.2))).toBeTruthy();
});
- t.equal(toSafeInteger(3.2), 3, "Converts a value to a safe integer");
- t.equal(toSafeInteger('4.2'), 4, "toSafeInteger('4.2') returns 4");
- t.equal(toSafeInteger(4.6), 5, "toSafeInteger(4.6) returns 5");
- t.equal(toSafeInteger([]), 0, "toSafeInteger([]) returns 0");
- t.true(isNaN(toSafeInteger([1.5, 3124])), "isNaN(toSafeInteger([1.5, 3124])) is true");
- t.true(isNaN(toSafeInteger('string')), "isNaN(toSafeInteger('string')) is true");
- t.true(isNaN(toSafeInteger({})), "isNaN(toSafeInteger({})) is true");
- t.true(isNaN(toSafeInteger()), "isNaN(toSafeInteger()) is true");
- t.equal(toSafeInteger(Infinity), 9007199254740991, "toSafeInteger(Infinity) returns 9007199254740991");
+ test('Converts a value to a safe integer', () => {
+ expect(toSafeInteger(3.2)).toBe(3)
+});
+ test('toSafeInteger('4.2') returns 4', () => {
+ expect(toSafeInteger('4.2')).toBe(4)
+});
+ test('toSafeInteger(4.6) returns 5', () => {
+ expect(toSafeInteger(4.6)).toBe(5)
+});
+ test('toSafeInteger([]) returns 0', () => {
+ expect(toSafeInteger([])).toBe(0)
+});
+ test('isNaN(toSafeInteger([1.5, 3124])) is true', () => {
+ expect(isNaN(toSafeInteger([1.5, 3124]))).toBeTruthy()
+});
+ test('isNaN(toSafeInteger('string')) is true', () => {
+ expect(isNaN(toSafeInteger('string'))).toBeTruthy()
+});
+ test('isNaN(toSafeInteger({})) is true', () => {
+ expect(isNaN(toSafeInteger({}))).toBeTruthy()
+});
+ test('isNaN(toSafeInteger()) is true', () => {
+ expect(isNaN(toSafeInteger())).toBeTruthy()
+});
+ test('toSafeInteger(Infinity) returns 9007199254740991', () => {
+ expect(toSafeInteger(Infinity)).toBe(9007199254740991)
+});
let start = new Date().getTime();
toSafeInteger(3.2);
diff --git a/test/toSnakeCase/toSnakeCase.test.js b/test/toSnakeCase/toSnakeCase.test.js
index 89ad48fe6..ff0690f70 100644
--- a/test/toSnakeCase/toSnakeCase.test.js
+++ b/test/toSnakeCase/toSnakeCase.test.js
@@ -5,10 +5,18 @@ const toSnakeCase = require('./toSnakeCase.js');
test('toSnakeCase is a Function', () => {
expect(toSnakeCase).toBeInstanceOf(Function);
});
- t.equal(toSnakeCase('camelCase'), 'camel_case', "toSnakeCase('camelCase') returns camel_case");
- 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");
+ test('toSnakeCase('camelCase') returns camel_case', () => {
+ expect(toSnakeCase('camelCase')).toBe('camel_case')
+});
+ test('toSnakeCase('some text') returns some_text', () => {
+ expect(toSnakeCase('some text')).toBe('some_text')
+});
+ test('toSnakeCase('some-mixed_string With spaces_underscores-and-hyphens') returns some_mixed_string_with_spaces_underscores_and_hyphens', () => {
+ expect(toSnakeCase('some-mixed_string With spaces_underscores-and-hyphens')).toBe('some_mixed_string_with_spaces_underscores_and_hyphens')
+});
+ test('toSnakeCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML') returns i_am_listening_to_fm_while_loading_different_url_on_my_browser_and_also_editing_some_xml_and_html', () => {
+ expect(toSnakeCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML')).toBe('i_am_listening_to_fm_while_loading_different_url_on_my_browser_and_also_editing_some_xml_and_html')
+});
test('toSnakeCase() returns undefined', () => {
expect(toSnakeCase(), undefined).toBe()
});
diff --git a/test/truthCheckCollection/truthCheckCollection.test.js b/test/truthCheckCollection/truthCheckCollection.test.js
index 0a78a68b7..1c5d1a0ee 100644
--- a/test/truthCheckCollection/truthCheckCollection.test.js
+++ b/test/truthCheckCollection/truthCheckCollection.test.js
@@ -5,5 +5,7 @@ const truthCheckCollection = require('./truthCheckCollection.js');
test('truthCheckCollection is a Function', () => {
expect(truthCheckCollection).toBeInstanceOf(Function);
});
- t.equal(truthCheckCollection([{ user: 'Tinky-Winky', sex: 'male' }, { user: 'Dipsy', sex: 'male' }], 'sex'), true, "second argument is truthy on all elements of a collection");
+ test('second argument is truthy on all elements of a collection', () => {
+ expect(truthCheckCollection([{ user: 'Tinky-Winky', sex: 'male' }, { user: 'Dipsy', sex: 'male' }], 'sex')).toBe(true)
+});
diff --git a/test/union/union.test.js b/test/union/union.test.js
index 5e08864a3..a0a80f846 100644
--- a/test/union/union.test.js
+++ b/test/union/union.test.js
@@ -5,10 +5,18 @@ const union = require('./union.js');
test('union is a Function', () => {
expect(union).toBeInstanceOf(Function);
});
- t.deepEqual(union([1, 2, 3], [4, 3, 2]), [1, 2, 3, 4], "union([1, 2, 3], [4, 3, 2]) returns [1, 2, 3, 4]");
- t.deepEqual(union('str', 'asd'), [ 's', 't', 'r', 'a', 'd' ], "union('str', 'asd') returns [ 's', 't', 'r', 'a', 'd' ]");
- t.deepEqual(union([[], {}], [1, 2, 3]), [[], {}, 1, 2, 3], "union([[], {}], [1, 2, 3]) returns [[], {}, 1, 2, 3]");
- t.deepEqual(union([], []), [], "union([], []) returns []");
+ test('union([1, 2, 3], [4, 3, 2]) returns [1, 2, 3, 4]', () => {
+ expect(union([1, 2, 3], [4, 3, 2]), [1, 2, 3).toEqual(4])
+});
+ test('union('str', 'asd') returns [ 's', 't', 'r', 'a', 'd' ]', () => {
+ expect(union('str', 'asd'), [ 's', 't', 'r', 'a').toEqual('d' ])
+});
+ test('union([[], {}], [1, 2, 3]) returns [[], {}, 1, 2, 3]', () => {
+ expect(union([[], {}], [1, 2, 3]), [[], {}, 1, 2).toEqual(3])
+});
+ test('union([], []) returns []', () => {
+ expect(union([], [])).toEqual([])
+});
t.throws(() => union(), 'union() throws an error');
t.throws(() => union(true, 'str'), 'union(true, str) throws an error');
t.throws(() => union('false', true), 'union(false, true) throws an error');
diff --git a/test/uniqueElements/uniqueElements.test.js b/test/uniqueElements/uniqueElements.test.js
index 42f5afff6..061c4da8f 100644
--- a/test/uniqueElements/uniqueElements.test.js
+++ b/test/uniqueElements/uniqueElements.test.js
@@ -5,13 +5,27 @@ const uniqueElements = require('./uniqueElements.js');
test('uniqueElements is a Function', () => {
expect(uniqueElements).toBeInstanceOf(Function);
});
- t.deepEqual(uniqueElements([1, 2, 2, 3, 4, 4, 5]), [1,2,3,4,5], "uniqueElements([1, 2, 2, 3, 4, 4, 5]) returns [1,2,3,4,5]");
- t.deepEqual(uniqueElements([1, 23, 53]), [1, 23, 53], "uniqueElements([1, 23, 53]) returns [1, 23, 53]");
- t.deepEqual(uniqueElements([true, 0, 1, false, false, undefined, null, '']), [true, 0, 1, false, undefined, null, ''], "uniqueElements([true, 0, 1, false, false, undefined, null, '']) returns [true, 0, 1, false, false, undefined, null, '']");
- t.deepEqual(uniqueElements(), [], "uniqueElements() returns []");
- t.deepEqual(uniqueElements(null), [], "uniqueElements(null) returns []");
- t.deepEqual(uniqueElements(undefined), [], "uniqueElements(undefined) returns []");
- t.deepEqual(uniqueElements('strt'), ['s', 't', 'r'], "uniqueElements('strt') returns ['s', 't', 'r']");
+ test('uniqueElements([1, 2, 2, 3, 4, 4, 5]) returns [1,2,3,4,5]', () => {
+ expect(uniqueElements([1, 2, 2, 3, 4, 4, 5]), [1,2,3,4).toEqual(5])
+});
+ test('uniqueElements([1, 23, 53]) returns [1, 23, 53]', () => {
+ expect(uniqueElements([1, 23, 53]), [1, 23).toEqual(53])
+});
+ test('uniqueElements([true, 0, 1, false, false, undefined, null, '']) returns [true, 0, 1, false, false, undefined, null, '']', () => {
+ expect(uniqueElements([true, 0, 1, false, false, undefined, null, '']), [true, 0, 1, false, undefined, null).toEqual(''])
+});
+ test('uniqueElements() returns []', () => {
+ expect(uniqueElements()).toEqual([])
+});
+ test('uniqueElements(null) returns []', () => {
+ expect(uniqueElements(null)).toEqual([])
+});
+ test('uniqueElements(undefined) returns []', () => {
+ expect(uniqueElements(undefined)).toEqual([])
+});
+ test('uniqueElements('strt') returns ['s', 't', 'r']', () => {
+ expect(uniqueElements('strt'), ['s', 't').toEqual('r'])
+});
t.throws(() => uniqueElements(1, 1, 2543, 534, 5), 'uniqueElements(1, 1, 2543, 534, 5) throws an error');
t.throws(() => uniqueElements({}), 'uniqueElements({}) throws an error');
t.throws(() => uniqueElements(true), 'uniqueElements(true) throws an error');
diff --git a/test/without/without.test.js b/test/without/without.test.js
index 60d7def99..48967d1ce 100644
--- a/test/without/without.test.js
+++ b/test/without/without.test.js
@@ -5,10 +5,18 @@ const without = require('./without.js');
test('without is a Function', () => {
expect(without).toBeInstanceOf(Function);
});
- t.deepEqual(without([2, 1, 2, 3], 1, 2), [3], "without([2, 1, 2, 3], 1, 2) returns [3]");
- t.deepEqual(without([]), [], "without([]) returns []");
- t.deepEqual(without([3, 1, true, '3', true], '3', true), [3, 1], "without([3, 1, true, '3', true], '3', true) returns [3, 1]");
- t.deepEqual(without('string'.split(''), 's', 't', 'g'), ['r', 'i', 'n'], "without('string'.split(''), 's', 't', 'g') returns ['r', 'i', 'n']");
+ test('without([2, 1, 2, 3], 1, 2) returns [3]', () => {
+ expect(without([2, 1, 2, 3], 1, 2)).toEqual([3])
+});
+ test('without([]) returns []', () => {
+ expect(without([])).toEqual([])
+});
+ test('without([3, 1, true, '3', true], '3', true) returns [3, 1]', () => {
+ expect(without([3, 1, true, '3', true], '3', true), [3).toEqual(1])
+});
+ test('without('string'.split(''), 's', 't', 'g') returns ['r', 'i', 'n']', () => {
+ expect(without('string'.split(''), 's', 't', 'g'), ['r', 'i').toEqual('n'])
+});
t.throws(() => without(), 'without() throws an error');
t.throws(() => without(null), 'without(null) throws an error');
t.throws(() => without(undefined), 'without(undefined) throws an error');
diff --git a/test/words/words.test.js b/test/words/words.test.js
index 8df2f68da..ec99f3882 100644
--- a/test/words/words.test.js
+++ b/test/words/words.test.js
@@ -5,8 +5,12 @@ const words = require('./words.js');
test('words is a Function', () => {
expect(words).toBeInstanceOf(Function);
});
- t.deepEqual(words('I love javaScript!!'), ["I", "love", "javaScript"], "words('I love javaScript!!') returns [I, love, javaScript]");
- t.deepEqual(words('python, javaScript & coffee'), ["python", "javaScript", "coffee"], "words('python, javaScript & coffee') returns [python, javaScript, coffee]");
+ test('words('I love javaScript!!') returns [I, love, javaScript]', () => {
+ expect(words('I love javaScript!!'), ["I", "love").toEqual("javaScript"])
+});
+ test('words('python, javaScript & coffee') returns [python, javaScript, coffee]', () => {
+ expect(words('python, javaScript & coffee'), ["python", "javaScript").toEqual("coffee"])
+});
test('words(I love javaScript!!) returns an array', () => {
expect(Array.isArray(words('I love javaScript!!'))).toBeTruthy();
});