From 71d768320b65ef3a795fddc03c764c0d3ada22ab Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Mon, 18 Jun 2018 17:31:56 +0300 Subject: [PATCH] Test cleanup and fixes [i-l] --- test/JSONToDate/JSONToDate.test.js | 4 +- test/JSONToFile/JSONToFile.test.js | 6 +- test/inRange/inRange.test.js | 20 +++--- test/indexOfAll/indexOfAll.test.js | 12 ++-- test/initial/initial.test.js | 8 +-- .../initialize2DArray.test.js | 8 +-- .../initializeArrayWithRange.test.js | 8 +-- .../initializeArrayWithRangeRight.test.js | 4 +- .../initializeArrayWithValues.test.js | 8 +-- .../initializeNDArray.test.js | 4 +- test/intersection/intersection.test.js | 8 +-- test/intersectionBy/intersectionBy.test.js | 9 +-- .../intersectionWith/intersectionWith.test.js | 9 +-- test/invertKeyValues/invertKeyValues.test.js | 12 ++-- test/is/is.test.js | 69 +++++++++++++------ test/isAbsoluteURL/isAbsoluteURL.test.js | 16 +++-- test/isAnagram/isAnagram.test.js | 13 ++-- .../isArmstrongNumber.test.js | 4 +- test/isArray/isArray.test.js | 12 ++-- test/isArrayBuffer/isArrayBuffer.test.js | 4 +- test/isArrayLike/isArrayLike.test.js | 17 ++--- test/isBoolean/isBoolean.test.js | 12 ++-- test/isBrowser/isBrowser.test.js | 4 +- .../isBrowserTabFocused.test.js | 4 +- test/isDivisible/isDivisible.test.js | 7 +- test/isEmpty/isEmpty.test.js | 45 ++++++------ test/isEven/isEven.test.js | 12 ++-- test/isFunction/isFunction.test.js | 11 ++- test/isLowerCase/isLowerCase.test.js | 16 ++--- test/isMap/isMap.test.js | 4 +- test/isNil/isNil.test.js | 17 ++--- test/isNull/isNull.test.js | 12 ++-- test/isNumber/isNumber.test.js | 12 ++-- test/isObject/isObject.test.js | 13 ++-- test/isObjectLike/isObjectLike.test.js | 21 +++--- test/isPlainObject/isPlainObject.test.js | 13 ++-- test/isPrime/isPrime.test.js | 8 +-- test/isPrimitive/isPrimitive.test.js | 53 +++++++------- test/isPromiseLike/isPromiseLike.test.js | 16 ++--- test/isRegExp/isRegExp.test.js | 4 +- test/isSet/isSet.test.js | 4 +- test/isSimilar/isSimilar.test.js | 4 +- test/isSorted/isSorted.test.js | 49 +++++++------ test/isString/isString.test.js | 24 +++---- test/isSymbol/isSymbol.test.js | 8 +-- test/isTravisCI/isTravisCI.test.js | 21 +++--- test/isTypedArray/isTypedArray.test.js | 4 +- test/isUndefined/isUndefined.test.js | 7 +- test/isUpperCase/isUpperCase.test.js | 12 ++-- test/isValidJSON/isValidJSON.test.js | 16 ++--- test/isWeakMap/isWeakMap.test.js | 4 +- test/isWeakSet/isWeakSet.test.js | 4 +- test/join/join.test.js | 18 +++-- test/last/last.test.js | 39 ++++++----- test/lcm/lcm.test.js | 12 ++-- .../levenshteinDistance.test.js | 4 +- test/longestItem/longestItem.test.js | 8 +-- test/lowercaseKeys/lowercaseKeys.test.js | 17 ++--- test/luhnCheck/luhnCheck.test.js | 16 ++--- 59 files changed, 358 insertions(+), 452 deletions(-) diff --git a/test/JSONToDate/JSONToDate.test.js b/test/JSONToDate/JSONToDate.test.js index 9e271ee0c..8a9ca3412 100644 --- a/test/JSONToDate/JSONToDate.test.js +++ b/test/JSONToDate/JSONToDate.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const JSONToDate = require('./JSONToDate.js'); - - test('JSONToDate is a Function', () => { +test('JSONToDate is a Function', () => { expect(JSONToDate).toBeInstanceOf(Function); }); - diff --git a/test/JSONToFile/JSONToFile.test.js b/test/JSONToFile/JSONToFile.test.js index b46ee2c31..325eface8 100644 --- a/test/JSONToFile/JSONToFile.test.js +++ b/test/JSONToFile/JSONToFile.test.js @@ -1,10 +1,6 @@ const expect = require('expect'); const JSONToFile = require('./JSONToFile.js'); - - test('JSONToFile is a Function', () => { +test('JSONToFile is a Function', () => { expect(JSONToFile).toBeInstanceOf(Function); }); - - - diff --git a/test/inRange/inRange.test.js b/test/inRange/inRange.test.js index 0a61db452..5825a2f3b 100644 --- a/test/inRange/inRange.test.js +++ b/test/inRange/inRange.test.js @@ -1,20 +1,18 @@ const expect = require('expect'); const inRange = require('./inRange.js'); - - test('inRange is a Function', () => { +test('inRange is a Function', () => { expect(inRange).toBeInstanceOf(Function); }); - 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, 2, 5)).toBeTruthy(); }); - test('The given number falls within the given range', () => { - expect(inRange(3, 4)).toBe(true) +test('The given number falls within the given range', () => { + expect(inRange(3, 4)).toBeTruthy(); }); - 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(2, 3, 5)).toBeFalsy(); }); - test('The given number does not falls within the given range', () => { - expect(inRange(3, 2)).toBe(false) +test('The given number does not falls within the given range', () => { + expect(inRange(3, 2)).toBeTruthy(); }); - diff --git a/test/indexOfAll/indexOfAll.test.js b/test/indexOfAll/indexOfAll.test.js index f694d6a7b..0747df466 100644 --- a/test/indexOfAll/indexOfAll.test.js +++ b/test/indexOfAll/indexOfAll.test.js @@ -1,14 +1,12 @@ const expect = require('expect'); const indexOfAll = require('./indexOfAll.js'); - - test('indexOfAll is a Function', () => { +test('indexOfAll is a Function', () => { expect(indexOfAll).toBeInstanceOf(Function); }); - test('Returns all indices of val in an array', () => { - expect(indexOfAll([1, 2, 3, 1, 2, 3], 1), [0).toEqual(3]) +test('Returns all indices of val in an array', () => { + expect(indexOfAll([1, 2, 3, 1, 2, 3], 1)).toEqual([0,3]); }); - test('Returns all indices of val in an array', () => { - expect(indexOfAll([1, 2, 3], 4)).toEqual([]) +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 2659c902b..13a85b519 100644 --- a/test/initial/initial.test.js +++ b/test/initial/initial.test.js @@ -1,11 +1,9 @@ const expect = require('expect'); const initial = require('./initial.js'); - - test('initial is a Function', () => { +test('initial is a Function', () => { expect(initial).toBeInstanceOf(Function); }); - test('Returns all the elements of an array except the last one', () => { - expect(initial([1, 2, 3]), [1).toEqual(2]) +test('Returns all the elements of an array except the last one', () => { + expect(initial([1, 2, 3])).toEqual([1, 2])'' }); - diff --git a/test/initialize2DArray/initialize2DArray.test.js b/test/initialize2DArray/initialize2DArray.test.js index ee00d7560..c0e33de36 100644 --- a/test/initialize2DArray/initialize2DArray.test.js +++ b/test/initialize2DArray/initialize2DArray.test.js @@ -1,11 +1,9 @@ const expect = require('expect'); const initialize2DArray = require('./initialize2DArray.js'); - - test('initialize2DArray is a Function', () => { +test('initialize2DArray is a Function', () => { expect(initialize2DArray).toBeInstanceOf(Function); }); - test('Initializes a 2D array of given width and height and value', () => { - expect(initialize2DArray(2, 2, 0), [[0,0], [0).toEqual(0]]) +test('Initializes a 2D array of given width and height and value', () => { + expect(initialize2DArray(2, 2, 0)).toEqual([[0,0], [0,0]]); }); - diff --git a/test/initializeArrayWithRange/initializeArrayWithRange.test.js b/test/initializeArrayWithRange/initializeArrayWithRange.test.js index 23fedd17b..8d0febed9 100644 --- a/test/initializeArrayWithRange/initializeArrayWithRange.test.js +++ b/test/initializeArrayWithRange/initializeArrayWithRange.test.js @@ -1,11 +1,9 @@ const expect = require('expect'); const initializeArrayWithRange = require('./initializeArrayWithRange.js'); - - test('initializeArrayWithRange is a Function', () => { +test('initializeArrayWithRange is a Function', () => { expect(initializeArrayWithRange).toBeInstanceOf(Function); }); - test('Initializes an array containing the numbers in the specified range', () => { - expect(initializeArrayWithRange(5), [0, 1, 2, 3, 4).toEqual(5]) +test('Initializes an array containing the numbers in the specified range', () => { + expect(initializeArrayWithRange(5)).toEqual([0, 1, 2, 3, 4, 5]); }); - diff --git a/test/initializeArrayWithRangeRight/initializeArrayWithRangeRight.test.js b/test/initializeArrayWithRangeRight/initializeArrayWithRangeRight.test.js index 0bc006ff7..61f60f825 100644 --- a/test/initializeArrayWithRangeRight/initializeArrayWithRangeRight.test.js +++ b/test/initializeArrayWithRangeRight/initializeArrayWithRangeRight.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const initializeArrayWithRangeRight = require('./initializeArrayWithRangeRight.js'); - - test('initializeArrayWithRangeRight is a Function', () => { +test('initializeArrayWithRangeRight is a Function', () => { expect(initializeArrayWithRangeRight).toBeInstanceOf(Function); }); - diff --git a/test/initializeArrayWithValues/initializeArrayWithValues.test.js b/test/initializeArrayWithValues/initializeArrayWithValues.test.js index 6b6861f46..5114c99e8 100644 --- a/test/initializeArrayWithValues/initializeArrayWithValues.test.js +++ b/test/initializeArrayWithValues/initializeArrayWithValues.test.js @@ -1,11 +1,9 @@ const expect = require('expect'); const initializeArrayWithValues = require('./initializeArrayWithValues.js'); - - test('initializeArrayWithValues is a Function', () => { +test('initializeArrayWithValues is a Function', () => { expect(initializeArrayWithValues).toBeInstanceOf(Function); }); - test('Initializes and fills an array with the specified values', () => { - expect(initializeArrayWithValues(5, 2), [2, 2, 2, 2).toEqual(2]) +test('Initializes and fills an array with the specified values', () => { + expect(initializeArrayWithValues(5, 2)).toEqual([2, 2, 2, 2, 2]) }); - diff --git a/test/initializeNDArray/initializeNDArray.test.js b/test/initializeNDArray/initializeNDArray.test.js index 52de243ff..df9199213 100644 --- a/test/initializeNDArray/initializeNDArray.test.js +++ b/test/initializeNDArray/initializeNDArray.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const initializeNDArray = require('./initializeNDArray.js'); - - test('initializeNDArray is a Function', () => { +test('initializeNDArray is a Function', () => { expect(initializeNDArray).toBeInstanceOf(Function); }); - diff --git a/test/intersection/intersection.test.js b/test/intersection/intersection.test.js index 72316771f..39186b7bb 100644 --- a/test/intersection/intersection.test.js +++ b/test/intersection/intersection.test.js @@ -1,11 +1,9 @@ const expect = require('expect'); const intersection = require('./intersection.js'); - - test('intersection is a Function', () => { +test('intersection is a Function', () => { expect(intersection).toBeInstanceOf(Function); }); - test('Returns a list of elements that exist in both arrays', () => { - expect(intersection([1, 2, 3], [4, 3, 2]), [2).toEqual(3]) +test('Returns a list of elements that exist in both arrays', () => { + expect(intersection([1, 2, 3], [4, 3, 2])).toEqual([2, 3]); }); - diff --git a/test/intersectionBy/intersectionBy.test.js b/test/intersectionBy/intersectionBy.test.js index 2c5207f23..5d69246bd 100644 --- a/test/intersectionBy/intersectionBy.test.js +++ b/test/intersectionBy/intersectionBy.test.js @@ -1,12 +1,9 @@ const expect = require('expect'); const intersectionBy = require('./intersectionBy.js'); - - test('intersectionBy is a Function', () => { +test('intersectionBy is a Function', () => { expect(intersectionBy).toBeInstanceOf(Function); }); - test('Returns a list of elements that exist in both arrays, after applying the provided function to each array element of both', () => { - expect(intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor), [2.1]).toEqual() +test('Returns a list of elements that exist in both arrays, after applying the provided function to each array element of both', () => { + expect(intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor)).toEqual([2.1]); }); - - diff --git a/test/intersectionWith/intersectionWith.test.js b/test/intersectionWith/intersectionWith.test.js index 09ed1a88e..7063575a7 100644 --- a/test/intersectionWith/intersectionWith.test.js +++ b/test/intersectionWith/intersectionWith.test.js @@ -1,12 +1,9 @@ const expect = require('expect'); const intersectionWith = require('./intersectionWith.js'); - - test('intersectionWith is a Function', () => { +test('intersectionWith is a Function', () => { expect(intersectionWith).toBeInstanceOf(Function); }); - test('Returns a list of elements that exist in both arrays, using a provided comparator function', () => { - expect(intersectionWith([1, 1.2, 1.5, 3, 0], [1.9, 3, 0, 3.9], (a, b) => Math.round(a) === Math.round(b)), [1.5, 3, 0]).toEqual() +test('Returns a list of elements that exist in both arrays, using a provided comparator function', () => { + expect(intersectionWith([1, 1.2, 1.5, 3, 0], [1.9, 3, 0, 3.9], (a, b) => Math.round(a) === Math.round(b))).toEqual([1.5, 3, 0]); }); - - diff --git a/test/invertKeyValues/invertKeyValues.test.js b/test/invertKeyValues/invertKeyValues.test.js index 0c036fc66..5bc005e4e 100644 --- a/test/invertKeyValues/invertKeyValues.test.js +++ b/test/invertKeyValues/invertKeyValues.test.js @@ -1,14 +1,12 @@ const expect = require('expect'); const invertKeyValues = require('./invertKeyValues.js'); - - test('invertKeyValues is a Function', () => { +test('invertKeyValues is a Function', () => { expect(invertKeyValues).toBeInstanceOf(Function); }); - test('invertKeyValues({ a: 1, b: 2, c: 1 }) returns { 1: [ 'a', 'c' ], 2: [ 'b' ] }', () => { - expect(invertKeyValues({ a: 1, b: 2, c: 1 }), { 1: [ 'a', 'c' ]).toEqual(2: [ 'b' ] }) +test('invertKeyValues({ a: 1, b: 2, c: 1 }) returns { 1: [ 'a', 'c' ], 2: [ 'b' ] }', () => { + expect(invertKeyValues({ a: 1, b: 2, c: 1 })).toEqual({ 1: [ 'a', 'c' ], 2: [ 'b' ] }); }); - test('invertKeyValues({ a: 1, b: 2, c: 1 }, value => 'group' + value) returns { group1: [ 'a', 'c' ], group2: [ 'b' ] }', () => { - expect(invertKeyValues({ a: 1, b: 2, c: 1 }, value => 'group' + value), { group1: [ 'a', 'c' ]).toEqual(group2: [ 'b' ] }) +test('invertKeyValues({ a: 1, b: 2, c: 1 }, value => 'group' + value) returns { group1: [ 'a', 'c' ], group2: [ 'b' ] }', () => { + expect(invertKeyValues({ a: 1, b: 2, c: 1 }, value => 'group' + value)).toEqual( { group1: [ 'a', 'c' ], group2: [ 'b' ] }); }); - diff --git a/test/is/is.test.js b/test/is/is.test.js index e1fafc039..0ad1f8bc6 100644 --- a/test/is/is.test.js +++ b/test/is/is.test.js @@ -1,25 +1,54 @@ const expect = require('expect'); const is = require('./is.js'); - - test('is is a Function', () => { +test('is is a Function', () => { expect(is).toBeInstanceOf(Function); }); - t.true(is(Array, [1]), `Works for arrays with data`); - t.true(is(Array, []), `Works for empty arrays`); - t.false(is(Array, {}), `Works for arrays, not objects`); - t.true(is(Object, {}), `Works for objects`); - t.true(is(Map, new Map()), `Works for maps`); - t.true(is(RegExp, /./g), `Works for regular expressions`); - t.true(is(Set, new Set()), `Works for sets`); - t.true(is(WeakMap, new WeakMap()), `Works for weak maps`); - t.true(is(WeakSet, new WeakSet()), `Works for weak sets`); - t.true(is(String, ''), `Works for strings - returns true for primitive`); - t.true(is(String, new String('')), `Works for strings - returns true when using constructor`); - t.true(is(Number, 1), `Works for numbers - returns true for primitive`); - t.true(is(Number, new Number('10')), `Works for numbers - returns true when using constructor`); - t.true(is(Boolean, false), `Works for booleans - returns true for primitive`); - t.true(is(Boolean, new Boolean(false)), `Works for booleans - returns true when using constructor`); - t.true(is(Function, () => null), `Works for functions`); - - +test('Works for arrays with data', () => { + expect(is(Array, [1])).toBeTruthy(); +}); +test('Works for empty arrays', () => { + expect(is(Array, [])).toBeTruthy() +}); +test('Works for arrays, not objects', () => { + expect(is(Array, {})).toBeFalsy(); +}); +test('Works for objects', () => { + expect(is(Object, {})).toBeTruthy(); +}); +test('Works for maps', () => { + expect(is(Map, new Map())).toBeTruthy(); +}); +test('Works for regular expressions', () => { + expect(is(RegExp, /./g)).toBeTruthy(); +}); +test('Works for sets', () => { + expect(is(Set, new Set())).toBeTruthy(); +}); +test('Works for weak maps', () => { + expect(is(WeakMap, new WeakMap())).toBeTruthy(); +}); +test('Works for weak sets', () => { + expect(is(WeakSet, new WeakSet())).toBeTruthy(); +}); +test('Works for strings - returns true for primitive', () => { + expect(is(String, '')).toBeTruthy(); +}); +test('Works for strings - returns true when using constructor', () => { + expect(is(String, new String(''))).toBeTruthy(); +}); +test('Works for numbers - returns true for primitive', () => { + expect(is(Number, 1)).toBeTruthy(); +}); +test('Works for numbers - returns true when using constructor', () => { + expect(is(Number, new Number('10'))).toBeTruthy() +}); +test('Works for booleans - returns true for primitive', () => { + expect(is(Boolean, false)).toBeTruthy() +}); +test('Works for booleans - returns true when using constructor', () => { + expect(is(Boolean, new Boolean(false))).toBeTruthy(); +}); +test('Works for functions', () => { + expect(is(Function, () => null)).toBeTruthy(); +}); diff --git a/test/isAbsoluteURL/isAbsoluteURL.test.js b/test/isAbsoluteURL/isAbsoluteURL.test.js index 0ddda8fbb..806ac881c 100644 --- a/test/isAbsoluteURL/isAbsoluteURL.test.js +++ b/test/isAbsoluteURL/isAbsoluteURL.test.js @@ -1,13 +1,15 @@ const expect = require('expect'); const isAbsoluteURL = require('./isAbsoluteURL.js'); - - test('isAbsoluteURL is a Function', () => { +test('isAbsoluteURL is a Function', () => { expect(isAbsoluteURL).toBeInstanceOf(Function); }); - t.equal(isAbsoluteURL('https: - t.equal(isAbsoluteURL('ftp: - test('Given string is not an absolute URL', () => { - expect(isAbsoluteURL('/foo/bar')).toBe(false) +test('Given string is an absolute URL', () => { + expect(isAbsoluteURL('https://google.com')).toBeTruthy(); +}); +test('Given string is an absolute URL', () => { + expect(isAbsoluteURL('ftp://www.myserver.net')).toBeTruthy(); +}); +test('Given string is not an absolute URL', () => { + expect(isAbsoluteURL('/foo/bar')).toBeFalsy(); }); - diff --git a/test/isAnagram/isAnagram.test.js b/test/isAnagram/isAnagram.test.js index 426050546..6fc0a9cb6 100644 --- a/test/isAnagram/isAnagram.test.js +++ b/test/isAnagram/isAnagram.test.js @@ -1,21 +1,18 @@ const expect = require('expect'); const isAnagram = require('./isAnagram.js'); - - test('isAnagram is a Function', () => { +test('isAnagram is a Function', () => { expect(isAnagram).toBeInstanceOf(Function); }); - test('Checks valid anagram', () => { +test('Checks valid anagram', () => { expect(isAnagram('iceman', 'cinema')).toBeTruthy(); }); - test('Works with spaces', () => { +test('Works with spaces', () => { expect(isAnagram('rail safety', 'fairy tales')).toBeTruthy(); }); - test('Ignores case', () => { +test('Ignores case', () => { expect(isAnagram('roast beef', 'eat for BSE')).toBeTruthy(); }); - test('Ignores special characters', () => { +test('Ignores special characters', () => { expect(isAnagram('Regera Dowdy', 'E. G. Deadworry')).toBeTruthy(); }); - - diff --git a/test/isArmstrongNumber/isArmstrongNumber.test.js b/test/isArmstrongNumber/isArmstrongNumber.test.js index a62809e2a..946cfa76f 100644 --- a/test/isArmstrongNumber/isArmstrongNumber.test.js +++ b/test/isArmstrongNumber/isArmstrongNumber.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const isArmstrongNumber = require('./isArmstrongNumber.js'); - - test('isArmstrongNumber is a Function', () => { +test('isArmstrongNumber is a Function', () => { expect(isArmstrongNumber).toBeInstanceOf(Function); }); - diff --git a/test/isArray/isArray.test.js b/test/isArray/isArray.test.js index 63064f7bd..e9e15dc19 100644 --- a/test/isArray/isArray.test.js +++ b/test/isArray/isArray.test.js @@ -1,14 +1,12 @@ const expect = require('expect'); const isArray = require('./isArray.js'); - - test('isArray is a Function', () => { +test('isArray is a Function', () => { expect(isArray).toBeInstanceOf(Function); }); - test('passed value is an array', () => { - expect(isArray([1])).toBe(true) +test('passed value is an array', () => { + expect(isArray([1])).toBeTruthy() }); - test('passed value is not an array', () => { - expect(isArray('array')).toBe(false) +test('passed value is not an array', () => { + expect(isArray('array')).toBeFalsy(); }); - diff --git a/test/isArrayBuffer/isArrayBuffer.test.js b/test/isArrayBuffer/isArrayBuffer.test.js index 54471ef95..fb65e81de 100644 --- a/test/isArrayBuffer/isArrayBuffer.test.js +++ b/test/isArrayBuffer/isArrayBuffer.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const isArrayBuffer = require('./isArrayBuffer.js'); - - test('isArrayBuffer is a Function', () => { +test('isArrayBuffer is a Function', () => { expect(isArrayBuffer).toBeInstanceOf(Function); }); - diff --git a/test/isArrayLike/isArrayLike.test.js b/test/isArrayLike/isArrayLike.test.js index a274a66db..19fa803cd 100644 --- a/test/isArrayLike/isArrayLike.test.js +++ b/test/isArrayLike/isArrayLike.test.js @@ -1,18 +1,15 @@ const expect = require('expect'); const isArrayLike = require('./isArrayLike.js'); - - test('isArrayLike is a Function', () => { +test('isArrayLike is a Function', () => { expect(isArrayLike).toBeInstanceOf(Function); }); - test('Returns true for a string', () => { - expect(isArrayLike('abc'), true).toBe() +test('Returns true for a string', () => { + expect(isArrayLike('abc')).toBeTruthy() }); - test('Returns true for an array', () => { - expect(isArrayLike([1,2,3]), true).toBe() +test('Returns true for an array', () => { + expect(isArrayLike([1,2,3])).toBeTruthy(); }); - test('Returns false for null', () => { - expect(isArrayLike(null), false).toBe() +test('Returns false for null', () => { + expect(isArrayLike(null)).toBeFalsy(); }); - - diff --git a/test/isBoolean/isBoolean.test.js b/test/isBoolean/isBoolean.test.js index e362c7b3e..31074f1f4 100644 --- a/test/isBoolean/isBoolean.test.js +++ b/test/isBoolean/isBoolean.test.js @@ -1,14 +1,12 @@ const expect = require('expect'); const isBoolean = require('./isBoolean.js'); - - test('isBoolean is a Function', () => { +test('isBoolean is a Function', () => { expect(isBoolean).toBeInstanceOf(Function); }); - test('passed value is not a boolean', () => { - expect(isBoolean(null)).toBe(false) +test('passed value is not a boolean', () => { + expect(isBoolean(null)).toBeFalsy(); }); - test('passed value is not a boolean', () => { - expect(isBoolean(false)).toBe(true) +test('passed value is not a boolean', () => { + expect(isBoolean(false)).toBeTruthy(); }); - diff --git a/test/isBrowser/isBrowser.test.js b/test/isBrowser/isBrowser.test.js index 7296ed250..a6c32ee74 100644 --- a/test/isBrowser/isBrowser.test.js +++ b/test/isBrowser/isBrowser.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const isBrowser = require('./isBrowser.js'); - - test('isBrowser is a Function', () => { +test('isBrowser is a Function', () => { expect(isBrowser).toBeInstanceOf(Function); }); - diff --git a/test/isBrowserTabFocused/isBrowserTabFocused.test.js b/test/isBrowserTabFocused/isBrowserTabFocused.test.js index 3ec43b2db..780a52095 100644 --- a/test/isBrowserTabFocused/isBrowserTabFocused.test.js +++ b/test/isBrowserTabFocused/isBrowserTabFocused.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const isBrowserTabFocused = require('./isBrowserTabFocused.js'); - - test('isBrowserTabFocused is a Function', () => { +test('isBrowserTabFocused is a Function', () => { expect(isBrowserTabFocused).toBeInstanceOf(Function); }); - diff --git a/test/isDivisible/isDivisible.test.js b/test/isDivisible/isDivisible.test.js index adb867938..3f71c4f03 100644 --- a/test/isDivisible/isDivisible.test.js +++ b/test/isDivisible/isDivisible.test.js @@ -1,11 +1,10 @@ const expect = require('expect'); const isDivisible = require('./isDivisible.js'); - - test('isDivisible is a Function', () => { +test('isDivisible is a Function', () => { expect(isDivisible).toBeInstanceOf(Function); }); - test('The number 6 is divisible by 3', () => { - expect(isDivisible(6, 3), true).toBe() +test('The number 6 is divisible by 3', () => { + expect(isDivisible(6, 3)).toBeTruthy(); }); diff --git a/test/isEmpty/isEmpty.test.js b/test/isEmpty/isEmpty.test.js index 0144a4096..da27a5581 100644 --- a/test/isEmpty/isEmpty.test.js +++ b/test/isEmpty/isEmpty.test.js @@ -1,39 +1,36 @@ const expect = require('expect'); const isEmpty = require('./isEmpty.js'); - - test('isEmpty is a Function', () => { +test('isEmpty is a Function', () => { expect(isEmpty).toBeInstanceOf(Function); }); - test('Returns true for empty Map', () => { - expect(isEmpty(new Map()), true).toBe() +test('Returns true for empty Map', () => { + expect(isEmpty(new Map())).toBeTruthy(); }); - test('Returns true for empty Set', () => { - expect(isEmpty(new Set()), true).toBe() +test('Returns true for empty Set', () => { + expect(isEmpty(new Set())).toBeTruthy(); }); - test('Returns true for empty array', () => { - expect(isEmpty([]), true).toBe() +test('Returns true for empty array', () => { + expect(isEmpty([])).toBeTruthy(); }); - test('Returns true for empty object', () => { - expect(isEmpty({}), true).toBe() +test('Returns true for empty object', () => { + expect(isEmpty({})).toBeTruthy(); }); - test('Returns true for empty string', () => { - expect(isEmpty(''), true).toBe() +test('Returns true for empty string', () => { + expect(isEmpty('')).toBeTruthy(); }); - test('Returns false for non-empty array', () => { - expect(isEmpty([1, 2]), false).toBe() +test('Returns false for non-empty array', () => { + expect(isEmpty([1, 2])).toBeFalsy(); }); - test('Returns false for non-empty object', () => { - expect(isEmpty({ a: 1, b: 2 }), false).toBe() +test('Returns false for non-empty object', () => { + expect(isEmpty({ a: 1, b: 2 })).toBeFalsy(); }); - test('Returns false for non-empty string', () => { - expect(isEmpty('text'), false).toBe() +test('Returns false for non-empty string', () => { + expect(isEmpty('text')).toBeFalsy(); }); - test('Returns true - type is not considered a collection', () => { - expect(isEmpty(123), true).toBe() +test('Returns true - type is not considered a collection', () => { + expect(isEmpty(123)).toBeTruthy(); }); - test('Returns true - type is not considered a collection', () => { - expect(isEmpty(true), true).toBe() +test('Returns true - type is not considered a collection', () => { + expect(isEmpty(true)).toBeTruthy(); }); - - diff --git a/test/isEven/isEven.test.js b/test/isEven/isEven.test.js index 3a1136da1..906f42b7b 100644 --- a/test/isEven/isEven.test.js +++ b/test/isEven/isEven.test.js @@ -1,14 +1,12 @@ const expect = require('expect'); const isEven = require('./isEven.js'); - - test('isEven is a Function', () => { +test('isEven is a Function', () => { expect(isEven).toBeInstanceOf(Function); }); - test('4 is even number', () => { - expect(isEven(4), true).toBe() +test('4 is even number', () => { + expect(isEven(4)).toBeTruthy(); }); - test('5 is not an even number', () => { - expect(isEven(5), false).toBeFalsy(); +test('5 is not an even number', () => { + expect(isEven(5)).toBeFalsy(); }); - diff --git a/test/isFunction/isFunction.test.js b/test/isFunction/isFunction.test.js index 50d8e7579..2d6d8db81 100644 --- a/test/isFunction/isFunction.test.js +++ b/test/isFunction/isFunction.test.js @@ -1,14 +1,13 @@ const expect = require('expect'); const isFunction = require('./isFunction.js'); - - test('isFunction is a Function', () => { +test('isFunction is a Function', () => { expect(isFunction).toBeInstanceOf(Function); }); - test('passed value is a function', () => { - expect(isFunction(x => x)).toBe(true) +test('passed value is a function', () => { + expect(isFunction(x => x)).toBeTruthy(); }); - test('passed value is not a function', () => { - expect(isFunction('x')).toBe(false) +test('passed value is not a function', () => { + expect(isFunction('x')).toBeFalsy(); }); diff --git a/test/isLowerCase/isLowerCase.test.js b/test/isLowerCase/isLowerCase.test.js index 486345594..9c6542476 100644 --- a/test/isLowerCase/isLowerCase.test.js +++ b/test/isLowerCase/isLowerCase.test.js @@ -1,17 +1,15 @@ const expect = require('expect'); const isLowerCase = require('./isLowerCase.js'); - - test('isLowerCase is a Function', () => { +test('isLowerCase is a Function', () => { expect(isLowerCase).toBeInstanceOf(Function); }); - test('passed string is a lowercase', () => { - expect(isLowerCase('abc')).toBe(true) +test('passed string is a lowercase', () => { + expect(isLowerCase('abc')).toBeTruthy(); }); - test('passed string is a lowercase', () => { - expect(isLowerCase('a3@$')).toBe(true) +test('passed string is a lowercase', () => { + expect(isLowerCase('a3@$')).toBeTruthy(); }); - test('passed value is not a lowercase', () => { - expect(isLowerCase('A3@$')).toBe(false) +test('passed value is not a lowercase', () => { + expect(isLowerCase('A3@$')).toBeFalsy(); }); - diff --git a/test/isMap/isMap.test.js b/test/isMap/isMap.test.js index 3be014cbb..e6e434636 100644 --- a/test/isMap/isMap.test.js +++ b/test/isMap/isMap.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const isMap = require('./isMap.js'); - - test('isMap is a Function', () => { +test('isMap is a Function', () => { expect(isMap).toBeInstanceOf(Function); }); - diff --git a/test/isNil/isNil.test.js b/test/isNil/isNil.test.js index e193e8075..be77815a2 100644 --- a/test/isNil/isNil.test.js +++ b/test/isNil/isNil.test.js @@ -1,18 +1,15 @@ const expect = require('expect'); const isNil = require('./isNil.js'); - - test('isNil is a Function', () => { +test('isNil is a Function', () => { expect(isNil).toBeInstanceOf(Function); }); - test('Returns true for null', () => { - expect(isNil(null), true).toBe() +test('Returns true for null', () => { + expect(isNil(null)).toBeTruthy(); }); - test('Returns true for undefined', () => { - expect(isNil(undefined), true).toBe() +test('Returns true for undefined', () => { + expect(isNil(undefined)).toBeTruthy(); }); - test('Returns false for an empty string', () => { - expect(isNil(''), false).toBe() +test('Returns false for an empty string', () => { + expect(isNil('')).toBeFalsy(); }); - - diff --git a/test/isNull/isNull.test.js b/test/isNull/isNull.test.js index feb99d1bc..fdf97d069 100644 --- a/test/isNull/isNull.test.js +++ b/test/isNull/isNull.test.js @@ -1,14 +1,12 @@ const expect = require('expect'); const isNull = require('./isNull.js'); - - test('isNull is a Function', () => { +test('isNull is a Function', () => { expect(isNull).toBeInstanceOf(Function); }); - test('passed argument is a null', () => { - expect(isNull(null)).toBe(true) +test('passed argument is a null', () => { + expect(isNull(null)).toBeTruthy(); }); - test('passed argument is a null', () => { - expect(isNull(NaN)).toBe(false) +test('passed argument is a null', () => { + expect(isNull(NaN)).toBeFalsy(); }); - diff --git a/test/isNumber/isNumber.test.js b/test/isNumber/isNumber.test.js index 662876c51..9b4872778 100644 --- a/test/isNumber/isNumber.test.js +++ b/test/isNumber/isNumber.test.js @@ -1,14 +1,12 @@ const expect = require('expect'); const isNumber = require('./isNumber.js'); - - test('isNumber is a Function', () => { +test('isNumber is a Function', () => { expect(isNumber).toBeInstanceOf(Function); }); - test('passed argument is a number', () => { - expect(isNumber(1)).toBe(true) +test('passed argument is a number', () => { + expect(isNumber(1)).toBeTruthy(); }); - test('passed argument is not a number', () => { - expect(isNumber('1')).toBe(false) +test('passed argument is not a number', () => { + expect(isNumber('1')).toBeFalsy(); }); - diff --git a/test/isObject/isObject.test.js b/test/isObject/isObject.test.js index a4f79d110..d5e58c496 100644 --- a/test/isObject/isObject.test.js +++ b/test/isObject/isObject.test.js @@ -1,22 +1,19 @@ const expect = require('expect'); const isObject = require('./isObject.js'); - - test('isObject is a Function', () => { +test('isObject is a Function', () => { expect(isObject).toBeInstanceOf(Function); }); - - test('isObject([1, 2, 3, 4]) is a object', () => { +test('isObject([1, 2, 3, 4]) is a object', () => { expect(isObject([1, 2, 3, 4])).toBeTruthy(); }); - test('isObject([]) is a object', () => { +test('isObject([]) is a object', () => { expect(isObject([])).toBeTruthy(); }); - test('isObject({ a:1 }) is a object', () => { +test('isObject({ a:1 }) is a object', () => { expect(isObject({ a:1 })).toBeTruthy(); }); - test('isObject(true) is not a object', () => { +test('isObject(true) is not a object', () => { expect(isObject(true)).toBeFalsy(); }); - diff --git a/test/isObjectLike/isObjectLike.test.js b/test/isObjectLike/isObjectLike.test.js index ad1f9c263..410878d8e 100644 --- a/test/isObjectLike/isObjectLike.test.js +++ b/test/isObjectLike/isObjectLike.test.js @@ -1,21 +1,18 @@ const expect = require('expect'); const isObjectLike = require('./isObjectLike.js'); - - test('isObjectLike is a Function', () => { +test('isObjectLike is a Function', () => { expect(isObjectLike).toBeInstanceOf(Function); }); - test('Returns true for an object', () => { - expect(isObjectLike({}), true).toBe() +test('Returns true for an object', () => { + expect(isObjectLike({})).toBeTruthy(); }); - test('Returns true for an array', () => { - expect(isObjectLike([1, 2, 3]), true).toBe() +test('Returns true for an array', () => { + expect(isObjectLike([1, 2, 3])).toBeTruthy(); }); - test('Returns false for a function', () => { - expect(isObjectLike(x => x), false).toBe() +test('Returns false for a function', () => { + expect(isObjectLike(x => x)).toBeFalsy(); }); - test('Returns false for null', () => { - expect(isObjectLike(null), false).toBe() +test('Returns false for null', () => { + expect(isObjectLike(null)).toBeFalsy(); }); - - diff --git a/test/isPlainObject/isPlainObject.test.js b/test/isPlainObject/isPlainObject.test.js index 48aea1309..eda33dabc 100644 --- a/test/isPlainObject/isPlainObject.test.js +++ b/test/isPlainObject/isPlainObject.test.js @@ -1,15 +1,12 @@ const expect = require('expect'); const isPlainObject = require('./isPlainObject.js'); - - test('isPlainObject is a Function', () => { +test('isPlainObject is a Function', () => { expect(isPlainObject).toBeInstanceOf(Function); }); - test('Returns true for a plain object', () => { - expect(isPlainObject({ a: 1 }), true).toBe() +test('Returns true for a plain object', () => { + expect(isPlainObject({ a: 1 })).toBeTruthy(); }); - test('Returns false for a Map (example of non-plain object)', () => { - expect(isPlainObject(new Map()), false).toBe() +test('Returns false for a Map (example of non-plain object)', () => { + expect(isPlainObject(new Map())).toBeFalsy(); }); - - diff --git a/test/isPrime/isPrime.test.js b/test/isPrime/isPrime.test.js index 1fd824ed7..f6776f687 100644 --- a/test/isPrime/isPrime.test.js +++ b/test/isPrime/isPrime.test.js @@ -1,11 +1,9 @@ const expect = require('expect'); const isPrime = require('./isPrime.js'); - - test('isPrime is a Function', () => { +test('isPrime is a Function', () => { expect(isPrime).toBeInstanceOf(Function); }); - test('passed number is a prime', () => { - expect(isPrime(11)).toBe(true) +test('passed number is a prime', () => { + expect(isPrime(11)).toBeTruthy(); }); - diff --git a/test/isPrimitive/isPrimitive.test.js b/test/isPrimitive/isPrimitive.test.js index 0083cd484..c9652b170 100644 --- a/test/isPrimitive/isPrimitive.test.js +++ b/test/isPrimitive/isPrimitive.test.js @@ -1,45 +1,42 @@ const expect = require('expect'); const isPrimitive = require('./isPrimitive.js'); - - test('isPrimitive is a Function', () => { +test('isPrimitive is a Function', () => { expect(isPrimitive).toBeInstanceOf(Function); }); - test('isPrimitive(null) is primitive', () => { - expect(isPrimitive(null)).toBeTruthy() +test('isPrimitive(null) is primitive', () => { + expect(isPrimitive(null)).toBeTruthy(); }); - test('isPrimitive(undefined) is primitive', () => { - expect(isPrimitive(undefined)).toBeTruthy() +test('isPrimitive(undefined) is primitive', () => { + expect(isPrimitive(undefined)).toBeTruthy(); }); - test('isPrimitive(string) is primitive', () => { - expect(isPrimitive('string')).toBeTruthy() +test('isPrimitive(string) is primitive', () => { + expect(isPrimitive('string')).toBeTruthy(); }); - test('isPrimitive(true) is primitive', () => { - expect(isPrimitive(true)).toBeTruthy() +test('isPrimitive(true) is primitive', () => { + expect(isPrimitive(true)).toBeTruthy(); }); - test('isPrimitive(50) is primitive', () => { - expect(isPrimitive(50)).toBeTruthy() +test('isPrimitive(50) is primitive', () => { + expect(isPrimitive(50)).toBeTruthy(); }); - test('isPrimitive('Hello') is primitive', () => { - expect(isPrimitive('Hello')).toBeTruthy() +test('isPrimitive('Hello') is primitive', () => { + expect(isPrimitive('Hello')).toBeTruthy(); }); - test('isPrimitive(false) is primitive', () => { - expect(isPrimitive(false)).toBeTruthy() +test('isPrimitive(false) is primitive', () => { + expect(isPrimitive(false)).toBeTruthy(); }); - test('isPrimitive(Symbol()) is primitive', () => { - expect(isPrimitive(Symbol())).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([1, 2, 3]) is not primitive', () => { + expect(isPrimitive([1, 2, 3])).toBeFalsy(); }); - test('isPrimitive({ a: 123 }) is not primitive', () => { - expect(isPrimitive({ a: 123 })).toBeFalsy() +test('isPrimitive({ a: 123 }) is not primitive', () => { + expect(isPrimitive({ a: 123 })).toBeFalsy(); }); - - let start = new Date().getTime(); - isPrimitive({ a: 123 - let end = new Date().getTime(); - test('isPrimitive({ a: 123 }) takes less than 2s to run', () => { +let start = new Date().getTime(); +isPrimitive({ a: 123 +let end = new Date().getTime(); +test('isPrimitive({ a: 123 }) takes less than 2s to run', () => { expect((end - start) < 2000).toBeTruthy(); }); - diff --git a/test/isPromiseLike/isPromiseLike.test.js b/test/isPromiseLike/isPromiseLike.test.js index 1205dab72..10877b4ec 100644 --- a/test/isPromiseLike/isPromiseLike.test.js +++ b/test/isPromiseLike/isPromiseLike.test.js @@ -1,20 +1,16 @@ const expect = require('expect'); const isPromiseLike = require('./isPromiseLike.js'); - - test('isPromiseLike is a Function', () => { +test('isPromiseLike is a Function', () => { expect(isPromiseLike).toBeInstanceOf(Function); }); - t.equal(isPromiseLike({ +test('Returns true for a promise-like object', () => { + expect(isPromiseLike({ then: function() { return ''; } - }), true, 'Returns true for a promise-like object'); - test('Returns false for null', () => { - expect(isPromiseLike(null), false).toBe() + })).toBeTruthy(); }); - test('Returns false for an empty object', () => { - expect(isPromiseLike({}), false).toBe() +test('Returns false for an empty object', () => { + expect(isPromiseLike({})).toBeFalsy(); }); - - diff --git a/test/isRegExp/isRegExp.test.js b/test/isRegExp/isRegExp.test.js index ef99fcdd0..ec565713f 100644 --- a/test/isRegExp/isRegExp.test.js +++ b/test/isRegExp/isRegExp.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const isRegExp = require('./isRegExp.js'); - - test('isRegExp is a Function', () => { +test('isRegExp is a Function', () => { expect(isRegExp).toBeInstanceOf(Function); }); - diff --git a/test/isSet/isSet.test.js b/test/isSet/isSet.test.js index e5e4c3630..559889443 100644 --- a/test/isSet/isSet.test.js +++ b/test/isSet/isSet.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const isSet = require('./isSet.js'); - - test('isSet is a Function', () => { +test('isSet is a Function', () => { expect(isSet).toBeInstanceOf(Function); }); - diff --git a/test/isSimilar/isSimilar.test.js b/test/isSimilar/isSimilar.test.js index f349dc7c9..0a632774e 100644 --- a/test/isSimilar/isSimilar.test.js +++ b/test/isSimilar/isSimilar.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const isSimilar = require('./isSimilar.js'); - - test('isSimilar is a Function', () => { +test('isSimilar is a Function', () => { expect(isSimilar).toBeInstanceOf(Function); }); - diff --git a/test/isSorted/isSorted.test.js b/test/isSorted/isSorted.test.js index d6a3d2716..d1d9fcfd9 100644 --- a/test/isSorted/isSorted.test.js +++ b/test/isSorted/isSorted.test.js @@ -1,42 +1,39 @@ const expect = require('expect'); const isSorted = require('./isSorted.js'); - - test('isSorted is a Function', () => { +test('isSorted is a Function', () => { expect(isSorted).toBeInstanceOf(Function); }); - test('Array is sorted in ascending order', () => { - expect(isSorted([0, 1, 2]), 1).toBe() +test('Array is sorted in ascending order', () => { + expect(isSorted([0, 1, 2])).toBe(1); }); - test('Array is sorted in ascending order', () => { - expect(isSorted([0, 1, 2, 2]), 1).toBe() +test('Array is sorted in ascending order', () => { + expect(isSorted([0, 1, 2, 2])).toBe(1); }); - test('Array is sorted in ascending order', () => { - expect(isSorted([-4, -3, -2]), 1).toBe() +test('Array is sorted in ascending order', () => { + expect(isSorted([-4, -3, -2])).toBe(1); }); - test('Array is sorted in ascending order', () => { - expect(isSorted([0, 0, 1, 2]), 1).toBe() +test('Array is sorted in ascending order', () => { + expect(isSorted([0, 0, 1, 2])).toBe(1); }); - test('Array is sorted in descending order', () => { - expect(isSorted([2, 1, 0]), -1).toBe() +test('Array is sorted in descending order', () => { + expect(isSorted([2, 1, 0])).toBe(-1); }); - test('Array is sorted in descending order', () => { - expect(isSorted([2, 2, 1, 0]), -1).toBe() +test('Array is sorted in descending order', () => { + expect(isSorted([2, 2, 1, 0])).toBe(-1); }); - test('Array is sorted in descending order', () => { - expect(isSorted([-2, -3, -4]), -1).toBe() +test('Array is sorted in descending order', () => { + expect(isSorted([-2, -3, -4])).toBe(-1); }); - test('Array is sorted in descending order', () => { - expect(isSorted([2, 1, 0, 0]), -1).toBe() +test('Array is sorted in descending order', () => { + expect(isSorted([2, 1, 0, 0])).toBe(-1); }); - test('Array is empty', () => { - expect(isSorted([]), undefined).toBe() +test('Array is empty', () => { + expect(isSorted([])).toBe(undefined); }); - test('Array is not sorted, direction changed in array', () => { - expect(isSorted([1]), 0).toBe() +test('Array is not sorted, direction changed in array', () => { + expect(isSorted([1])).toBe(0); }); - test('Array is not sorted, direction changed in array', () => { - expect(isSorted([1, 2, 1]), 0).toBe() +test('Array is not sorted, direction changed in array', () => { + expect(isSorted([1, 2, 1])).toBe(0); }); - - diff --git a/test/isString/isString.test.js b/test/isString/isString.test.js index 752346b28..d3021b275 100644 --- a/test/isString/isString.test.js +++ b/test/isString/isString.test.js @@ -1,23 +1,21 @@ const expect = require('expect'); const isString = require('./isString.js'); - - test('isString is a Function', () => { +test('isString is a Function', () => { expect(isString).toBeInstanceOf(Function); }); - test('foo is a string', () => { - expect(isString('foo'), true).toBe() +test('foo is a string', () => { + expect(isString('foo')).toBeTruthy(); }); - test('"10" is a string', () => { - expect(isString('10'), true).toBe() +test('"10" is a string', () => { + expect(isString('10')).toBeTruthy(); }); - test('Empty string is a string', () => { - expect(isString(''), true).toBe() +test('Empty string is a string', () => { + expect(isString('')).toBeTruthy(); }); - test('10 is not a string', () => { - expect(isString(10), false).toBe() +test('10 is not a string', () => { + expect(isString(10)).toBeFalsy(); }); - test('true is not string', () => { - expect(isString(true), false).toBe() +test('true is not string', () => { + expect(isString(true)).toBeFalsy(); }); - diff --git a/test/isSymbol/isSymbol.test.js b/test/isSymbol/isSymbol.test.js index a0c2a5181..7b614771b 100644 --- a/test/isSymbol/isSymbol.test.js +++ b/test/isSymbol/isSymbol.test.js @@ -1,11 +1,9 @@ const expect = require('expect'); const isSymbol = require('./isSymbol.js'); - - test('isSymbol is a Function', () => { +test('isSymbol is a Function', () => { expect(isSymbol).toBeInstanceOf(Function); }); - test('Checks if the given argument is a symbol', () => { - expect(isSymbol(Symbol('x'))).toBe(true) +test('Checks if the given argument is a symbol', () => { + expect(isSymbol(Symbol('x'))).toBeTruthy(); }); - diff --git a/test/isTravisCI/isTravisCI.test.js b/test/isTravisCI/isTravisCI.test.js index 787d4845f..3417f7776 100644 --- a/test/isTravisCI/isTravisCI.test.js +++ b/test/isTravisCI/isTravisCI.test.js @@ -1,17 +1,14 @@ const expect = require('expect'); const isTravisCI = require('./isTravisCI.js'); - - test('isTravisCI is a Function', () => { +test('isTravisCI is a Function', () => { expect(isTravisCI).toBeInstanceOf(Function); }); - if(isTravisCI()) - test('Running on Travis, correctly evaluates', () => { - expect(isTravisCI()).toBeTruthy(); -}); - else - test('Not running on Travis, correctly evaluates', () => { - expect(isTravisCI()).toBeFalsy(); -}); - - +if(isTravisCI()) + test('Running on Travis, correctly evaluates', () => { + expect(isTravisCI()).toBeTruthy(); + }); +else + test('Not running on Travis, correctly evaluates', () => { + expect(isTravisCI()).toBeFalsy(); + }); diff --git a/test/isTypedArray/isTypedArray.test.js b/test/isTypedArray/isTypedArray.test.js index cf37182b7..4264f8835 100644 --- a/test/isTypedArray/isTypedArray.test.js +++ b/test/isTypedArray/isTypedArray.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const isTypedArray = require('./isTypedArray.js'); - - test('isTypedArray is a Function', () => { +test('isTypedArray is a Function', () => { expect(isTypedArray).toBeInstanceOf(Function); }); - diff --git a/test/isUndefined/isUndefined.test.js b/test/isUndefined/isUndefined.test.js index 01b7b9095..60a725190 100644 --- a/test/isUndefined/isUndefined.test.js +++ b/test/isUndefined/isUndefined.test.js @@ -1,12 +1,9 @@ const expect = require('expect'); const isUndefined = require('./isUndefined.js'); - - test('isUndefined is a Function', () => { +test('isUndefined is a Function', () => { expect(isUndefined).toBeInstanceOf(Function); }); - test('Returns true for undefined', () => { +test('Returns true for undefined', () => { expect(isUndefined(undefined)).toBeTruthy(); }); - - diff --git a/test/isUpperCase/isUpperCase.test.js b/test/isUpperCase/isUpperCase.test.js index 650e0775a..d094ca53e 100644 --- a/test/isUpperCase/isUpperCase.test.js +++ b/test/isUpperCase/isUpperCase.test.js @@ -1,17 +1,15 @@ const expect = require('expect'); const isUpperCase = require('./isUpperCase.js'); - - test('isUpperCase is a Function', () => { +test('isUpperCase is a Function', () => { expect(isUpperCase).toBeInstanceOf(Function); }); - test('ABC is all upper case', () => { - expect(isUpperCase('ABC'), true).toBe() +test('ABC is all upper case', () => { + expect(isUpperCase('ABC')).toBeTruthy(); }); test('abc is not all upper case', () => { - expect(isUpperCase('abc'), false).toBe() + expect(isUpperCase('abc')).toBeFalsy(); }); test('A3@$ is all uppercase', () => { - expect(isUpperCase('A3@$'), true).toBe() + expect(isUpperCase('A3@$')).toBeTruthy(); }); - diff --git a/test/isValidJSON/isValidJSON.test.js b/test/isValidJSON/isValidJSON.test.js index 499d27685..6426d77ab 100644 --- a/test/isValidJSON/isValidJSON.test.js +++ b/test/isValidJSON/isValidJSON.test.js @@ -1,17 +1,15 @@ const expect = require('expect'); const isValidJSON = require('./isValidJSON.js'); - - test('isValidJSON is a Function', () => { +test('isValidJSON is a Function', () => { expect(isValidJSON).toBeInstanceOf(Function); }); - test('{"name":"Adam","age":20} is a valid JSON', () => { - expect(isValidJSON('{"name":"Adam","age":20}'), true).toBe() +test('{"name":"Adam","age":20} is a valid JSON', () => { + expect(isValidJSON('{"name":"Adam","age":20}')).toBeTruthy(); }); - test('{"name":"Adam",age:"20"} is not a valid JSON', () => { - expect(isValidJSON('{"name":"Adam",age:"20"}'), false).toBe() +test('{"name":"Adam",age:"20"} is not a valid JSON', () => { + expect(isValidJSON('{"name":"Adam",age:"20"}')).toBeFalsy(); }); - test('null is a valid JSON', () => { - expect(isValidJSON(null), true).toBe() +test('null is a valid JSON', () => { + expect(isValidJSON(null)).toBeTruthy(); }); - diff --git a/test/isWeakMap/isWeakMap.test.js b/test/isWeakMap/isWeakMap.test.js index 6ffa40525..6643677e9 100644 --- a/test/isWeakMap/isWeakMap.test.js +++ b/test/isWeakMap/isWeakMap.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const isWeakMap = require('./isWeakMap.js'); - - test('isWeakMap is a Function', () => { +test('isWeakMap is a Function', () => { expect(isWeakMap).toBeInstanceOf(Function); }); - diff --git a/test/isWeakSet/isWeakSet.test.js b/test/isWeakSet/isWeakSet.test.js index f071c38b3..2466138af 100644 --- a/test/isWeakSet/isWeakSet.test.js +++ b/test/isWeakSet/isWeakSet.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const isWeakSet = require('./isWeakSet.js'); - - test('isWeakSet is a Function', () => { +test('isWeakSet is a Function', () => { expect(isWeakSet).toBeInstanceOf(Function); }); - diff --git a/test/join/join.test.js b/test/join/join.test.js index 834314e00..d9bf08285 100644 --- a/test/join/join.test.js +++ b/test/join/join.test.js @@ -1,17 +1,15 @@ const expect = require('expect'); const join = require('./join.js'); - - test('join is a Function', () => { +test('join is a Function', () => { expect(join).toBeInstanceOf(Function); }); - 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'], ',', '&')).toEqual('pen,pineapple,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'], ',')).toEqual('pen,pineapple,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'])).toEqual('pen,pineapple,apple,pen'); +}); diff --git a/test/last/last.test.js b/test/last/last.test.js index ebc9c8281..8da663642 100644 --- a/test/last/last.test.js +++ b/test/last/last.test.js @@ -1,30 +1,33 @@ const expect = require('expect'); const last = require('./last.js'); - - test('last is a Function', () => { +test('last is a Function', () => { expect(last).toBeInstanceOf(Function); }); - test('last({ a: 1234}) returns undefined', () => { +test('last({ a: 1234}) returns undefined', () => { expect(last({ a: 1234}) === undefined).toBeTruthy(); }); - test('last([1, 2, 3]) returns 3', () => { - expect(last([1, 2, 3])).toBe(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() +test('last({ 0: false}) returns undefined', () => { + expect(last({ 0: false})).toBe(undefined); }); - test('last(String) returns g', () => { - expect(last('String'), 'g').toBe() +test('last(String) returns g', () => { + expect(last('String')).toBe('g'); }); - t.throws(() => last(null), 'last(null) throws an Error'); - t.throws(() => last(undefined), 'last(undefined) throws an Error'); - t.throws(() => last(), 'last() throws an Error'); - - let start = new Date().getTime(); - last([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]); - let end = new Date().getTime(); - test('last([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run', () => { +test('last(null) throws an Error', () => { + expect(last(null)).toThrow(); +}); +test('last(undefined) throws an Error', () => { + expect(last(undefined)).toThrow(); +}); +test('last() throws an Error', () => { + expect(last()).toThrow(); +}); +let start = new Date().getTime(); +last([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]); +let end = new Date().getTime(); +test('last([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run', () => { expect((end - start) < 2000).toBeTruthy(); }); - diff --git a/test/lcm/lcm.test.js b/test/lcm/lcm.test.js index 3decb409e..dfa340b88 100644 --- a/test/lcm/lcm.test.js +++ b/test/lcm/lcm.test.js @@ -1,14 +1,12 @@ const expect = require('expect'); const lcm = require('./lcm.js'); - - test('lcm is a Function', () => { +test('lcm is a Function', () => { expect(lcm).toBeInstanceOf(Function); }); - 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(12, 7)).toBe(84); }); - test('Returns the least common multiple of two or more numbers.', () => { - expect(lcm(...[1, 3, 4, 5])).toBe(60) +test('Returns the least common multiple of two or more numbers.', () => { + expect(lcm(...[1, 3, 4, 5])).toBe(60); }); - diff --git a/test/levenshteinDistance/levenshteinDistance.test.js b/test/levenshteinDistance/levenshteinDistance.test.js index 44ae20d78..c5556114d 100644 --- a/test/levenshteinDistance/levenshteinDistance.test.js +++ b/test/levenshteinDistance/levenshteinDistance.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const levenshteinDistance = require('./levenshteinDistance.js'); - - test('levenshteinDistance is a Function', () => { +test('levenshteinDistance is a Function', () => { expect(levenshteinDistance).toBeInstanceOf(Function); }); - diff --git a/test/longestItem/longestItem.test.js b/test/longestItem/longestItem.test.js index 244babd22..7e8c01357 100644 --- a/test/longestItem/longestItem.test.js +++ b/test/longestItem/longestItem.test.js @@ -1,11 +1,9 @@ const expect = require('expect'); const longestItem = require('./longestItem.js'); - - test('longestItem is a Function', () => { +test('longestItem is a Function', () => { expect(longestItem).toBeInstanceOf(Function); }); - test('Returns the longest object', () => { - expect(longestItem('this', 'is', 'a', 'testcase')).toEqual('testcase') +test('Returns the longest object', () => { + expect(longestItem('this', 'is', 'a', 'testcase')).toEqual('testcase'); }); - diff --git a/test/lowercaseKeys/lowercaseKeys.test.js b/test/lowercaseKeys/lowercaseKeys.test.js index ad8077094..37868e338 100644 --- a/test/lowercaseKeys/lowercaseKeys.test.js +++ b/test/lowercaseKeys/lowercaseKeys.test.js @@ -1,17 +1,14 @@ const expect = require('expect'); const lowercaseKeys = require('./lowercaseKeys.js'); - - test('lowercaseKeys is a Function', () => { +test('lowercaseKeys is a Function', () => { expect(lowercaseKeys).toBeInstanceOf(Function); }); - const myObj = { Name: 'Adam', sUrnAME: 'Smith' }; - const myObjLower = lowercaseKeys(myObj); - test('Lowercases object keys', () => { - expect(myObjLower, {name: 'Adam', surname: 'Smith'}).toEqual() +const myObj = { Name: 'Adam', sUrnAME: 'Smith' }; +const myObjLower = lowercaseKeys(myObj); +test('Lowercases object keys', () => { + expect(myObjLower).toEqual( {name: 'Adam', surname: 'Smith'}); }); - test('Does not mutate original object', () => { - expect(myObj, { Name: 'Adam', sUrnAME: 'Smith' }).toEqual() +test('Does not mutate original object', () => { + expect(myObj).toEqual({ Name: 'Adam', sUrnAME: 'Smith' }); }); - - diff --git a/test/luhnCheck/luhnCheck.test.js b/test/luhnCheck/luhnCheck.test.js index 938060e89..28d176fe5 100644 --- a/test/luhnCheck/luhnCheck.test.js +++ b/test/luhnCheck/luhnCheck.test.js @@ -1,17 +1,15 @@ const expect = require('expect'); const luhnCheck = require('./luhnCheck.js'); - - test('luhnCheck is a Function', () => { +test('luhnCheck is a Function', () => { expect(luhnCheck).toBeInstanceOf(Function); }); - test('validates identification number', () => { - expect(luhnCheck(6011329933655299)).toBe(false) +test('validates identification number', () => { + expect(luhnCheck(6011329933655299)).toBeFalsy(); }); - test('validates identification number', () => { - expect(luhnCheck('4485275742308327')).toBe(true) +test('validates identification number', () => { + expect(luhnCheck('4485275742308327')).toBeTruthy(); }); - test('validates identification number', () => { - expect(luhnCheck(123456789)).toBe(false) +test('validates identification number', () => { + expect(luhnCheck(123456789)).toBeFalsy(); }); -