diff --git a/test/when/when.test.js b/test/when/when.test.js index c736288f8..0feb021e8 100644 --- a/test/when/when.test.js +++ b/test/when/when.test.js @@ -1,18 +1,16 @@ const expect = require('expect'); const when = require('./when.js'); - - test('when is a Function', () => { +test('when is a Function', () => { expect(when).toBeInstanceOf(Function); }); - - const doubleEvenNumbers = when( - (x) => x % 2 === 0, - (x) => x * 2 - ); - - t.true(doubleEvenNumbers(2) === 4); - t.true(doubleEvenNumbers(1) === 1); - - - +const doubleEvenNumbers = when( + (x) => x % 2 === 0, + (x) => x * 2 +); +test('Returns the proper result', () => { + expect(doubleEvenNumbers(2)).toBe(4); +}); +test('Returns the proper result', () => { + expect(doubleEvenNumbers(1)).toBe(1); +}); diff --git a/test/without/without.test.js b/test/without/without.test.js index 48967d1ce..54ef78bb5 100644 --- a/test/without/without.test.js +++ b/test/without/without.test.js @@ -1,27 +1,33 @@ const expect = require('expect'); const without = require('./without.js'); - - test('without is a Function', () => { +test('without is a Function', () => { expect(without).toBeInstanceOf(Function); }); - test('without([2, 1, 2, 3], 1, 2) returns [3]', () => { - expect(without([2, 1, 2, 3], 1, 2)).toEqual([3]) +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([]) 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([3, 1, true, '3', true], '3', true) returns [3, 1]', () => { + expect(without([3, 1, true, '3', true], '3', true)).toEqual([3, 1]); }); - test('without('string'.split(''), 's', 't', 'g') returns ['r', 'i', 'n']', () => { - expect(without('string'.split(''), 's', 't', 'g'), ['r', 'i').toEqual('n']) +test('without('string'.split(''), 's', 't', 'g') returns [\'r\', \'i\', \'n\']', () => { + expect(without('string'.split(''), 's', 't', 'g')).toEqual(['r', 'i', 'n']); +}); +test('without() throws an error', () => { + expect(without()).toThrow(); +}); +test('without(null) throws an error', () => { + expect(without(null)).toThrow(); +}); +test('without(undefined) throws an error', () => { + expect(without(undefined)).toThrow(); +}); +test('without(123) throws an error', () => { + expect(without(123)).toThrow(); +}); +test('without({}) throws an error', () => { + expect(without({})).toThrow(); }); - 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'); - t.throws(() => without(123), 'without() throws an error'); - t.throws(() => without({}), 'without({}) throws an error'); - - - diff --git a/test/words/words.test.js b/test/words/words.test.js index ec99f3882..fbedafabf 100644 --- a/test/words/words.test.js +++ b/test/words/words.test.js @@ -1,25 +1,33 @@ const expect = require('expect'); const words = require('./words.js'); - - test('words is a Function', () => { +test('words is a Function', () => { expect(words).toBeInstanceOf(Function); }); - test('words('I love javaScript!!') returns [I, love, javaScript]', () => { - expect(words('I love javaScript!!'), ["I", "love").toEqual("javaScript"]) +test('words('I love javaScript!!') returns [I, love, javaScript]', () => { + expect(words('I love javaScript!!')).toEqual(["I", "love", "javaScript"]); }); - test('words('python, javaScript & coffee') returns [python, javaScript, coffee]', () => { - expect(words('python, javaScript & coffee'), ["python", "javaScript").toEqual("coffee"]) +test('words('python, javaScript & coffee') returns [python, javaScript, coffee]', () => { + expect(words('python, javaScript & coffee')).toEqual(["python", "javaScript", "coffee"]); }); - test('words(I love javaScript!!) returns an array', () => { +test('words(I love javaScript!!) returns an array', () => { expect(Array.isArray(words('I love javaScript!!'))).toBeTruthy(); }); - t.throws(() => words(), 'words() throws a error'); - t.throws(() => words(null), 'words(null) throws a error'); - t.throws(() => words(undefined), 'words(undefined) throws a error'); - t.throws(() => words({}), 'words({}) throws a error'); - t.throws(() => words([]), 'words([]) throws a error'); - t.throws(() => words(1234), 'words(1234) throws a error'); - - - +test('words() throws an error', () => { + expect(words()).toThrow(); +}); +test('words(null) throws an error', () => { + expect(words(null)).toThrow(); +}); +test('words(undefined) throws an error', () => { + expect(words(undefined)).toThrow(); +}); +test('words({}) throws an error', () => { + expect(words({})).toThrow(); +}); +test('words([]) throws an error', () => { + expect(words([])).toThrow(); +}); +test('words(1234) throws an error', () => { + expect(words(1234)).toThrow(); +}); diff --git a/test/xProd/xProd.test.js b/test/xProd/xProd.test.js index 392dcfd47..c4cea5de1 100644 --- a/test/xProd/xProd.test.js +++ b/test/xProd/xProd.test.js @@ -1,10 +1,9 @@ const expect = require('expect'); const xProd = require('./xProd.js'); - - test('xProd is a Function', () => { +test('xProd is a Function', () => { expect(xProd).toBeInstanceOf(Function); }); - t.deepEqual(xProd([1, 2], ['a', 'b']), [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']], `xProd([1, 2], ['a', 'b']) returns [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']]`); - - +test('xProd([1, 2], [\'a\', \'b\']) returns [[1, \'a\'], [1, \'b\'], [2, \'a\'], [2, \'b\']]', () => { + expect(xProd([1, 2], ['a', 'b'])).toEqual([[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']]); +}); diff --git a/test/yesNo/yesNo.test.js b/test/yesNo/yesNo.test.js index b3d658754..9bc825531 100644 --- a/test/yesNo/yesNo.test.js +++ b/test/yesNo/yesNo.test.js @@ -1,46 +1,42 @@ const expect = require('expect'); const yesNo = require('./yesNo.js'); - - test('yesNo is a Function', () => { +test('yesNo is a Function', () => { expect(yesNo).toBeInstanceOf(Function); }); - test('yesNo(Y) returns true', () => { +test('yesNo(Y) returns true', () => { expect(yesNo('Y')).toBeTruthy(); }); - test('yesNo(yes) returns true', () => { +test('yesNo(yes) returns true', () => { expect(yesNo('yes')).toBeTruthy(); }); - test('yesNo(foo, true) returns true', () => { +test('yesNo(foo, true) returns true', () => { expect(yesNo('foo', true)).toBeTruthy(); }); - test('yesNo(No) returns false', () => { +test('yesNo(No) returns false', () => { expect(yesNo('No')).toBeFalsy(); }); - test('yesNo() returns false', () => { +test('yesNo() returns false', () => { expect(yesNo()).toBeFalsy(); }); - test('yesNo(null) returns false', () => { +test('yesNo(null) returns false', () => { expect(yesNo(null)).toBeFalsy(); }); - test('yesNo(undefined) returns false', () => { +test('yesNo(undefined) returns false', () => { expect(yesNo(undefined)).toBeFalsy(); }); - test('yesNo([123, null]) returns false', () => { +test('yesNo([123, null]) returns false', () => { expect(yesNo([123, null])).toBeFalsy(); }); - test('yesNo([Yes, No]) returns false', () => { +test('yesNo([Yes, No]) returns false', () => { expect(yesNo(['Yes', 'No'])).toBeFalsy(); }); - test('yesNo({ 2: Yes }) returns false', () => { +test('yesNo({ 2: Yes }) returns false', () => { expect(yesNo({ 2: 'Yes' })).toBeFalsy(); }); - test('yesNo([Yes, No], true) returns true', () => { +test('yesNo([Yes, No], true) returns true', () => { expect(yesNo(['Yes', 'No'], true)).toBeTruthy(); }); - test('yesNo({ 2: Yes }, true) returns true', () => { +test('yesNo({ 2: Yes }, true) returns true', () => { expect(yesNo({ 2: 'Yes' }, true)).toBeTruthy(); }); - - - diff --git a/test/zip/zip.test.js b/test/zip/zip.test.js index f6af12c43..c9822d2c0 100644 --- a/test/zip/zip.test.js +++ b/test/zip/zip.test.js @@ -2,29 +2,30 @@ const expect = require('expect'); const zip = require('./zip.js'); - test('zip is a Function', () => { +test('zip is a Function', () => { expect(zip).toBeInstanceOf(Function); }); - test('zip([a, b], [1, 2], [true, false]) returns [[a, 1, true], [b, 2, false]]', () => { - expect(zip(['a', 'b'], [1, 2], [true, false]), [['a', 1, true], ['b', 2, false]]).toEqual() +test('zip([a, b], [1, 2], [true, false]) returns [[a, 1, true], [b, 2, false]]', () => { + expect(zip(['a', 'b'], [1, 2], [true, false])).toEqual([['a', 1, true], ['b', 2, false]]); }); - test('zip([a], [1, 2], [true, false]) returns [[a, 1, true], [undefined, 2, false]]', () => { - expect(zip(['a'], [1, 2], [true, false]), [['a', 1, true], [undefined, 2, false]]).toEqual() +test('zip([a], [1, 2], [true, false]) returns [[a, 1, true], [undefined, 2, false]]', () => { + expect(zip(['a'], [1, 2], [true, false])).toEqual([['a', 1, true], [undefined, 2, false]]); }); - test('zip([]) returns []', () => { - expect(zip(), []).toEqual() +test('zip([]) returns []', () => { + expect(zip()).toEqual([]); }); - test('zip(123) returns []', () => { - expect(zip(123), []).toEqual() +test('zip(123) returns []', () => { + expect(zip(123)).toEqual([]); }); - test('zip([a, b], [1, 2], [true, false]) returns an Array', () => { +test('zip([a, b], [1, 2], [true, false]) returns an Array', () => { expect(Array.isArray(zip(['a', 'b'], [1, 2], [true, false]))).toBeTruthy(); }); - test('zip([a], [1, 2], [true, false]) returns an Array', () => { +test('zip([a], [1, 2], [true, false]) returns an Array', () => { expect(Array.isArray(zip(['a'], [1, 2], [true, false]))).toBeTruthy(); }); - t.throws(() => zip(null), 'zip(null) throws an error'); - t.throws(() => zip(undefined), 'zip(undefined) throws an error'); - - - +test('zip(null) throws an error', () => { + expect(zip(null)).toThrow(); +}); +test('zip(undefined) throws an error', () => { + expect(zip(undefined)).toThrow(); +}); diff --git a/test/zipObject/zipObject.test.js b/test/zipObject/zipObject.test.js index b0a2b4b76..d07fe81df 100644 --- a/test/zipObject/zipObject.test.js +++ b/test/zipObject/zipObject.test.js @@ -1,27 +1,33 @@ const expect = require('expect'); const zipObject = require('./zipObject.js'); - - test('zipObject is a Function', () => { +test('zipObject is a Function', () => { expect(zipObject).toBeInstanceOf(Function); }); - test('zipObject([a, b, c], [1, 2]) returns {a: 1, b: 2, c: undefined}', () => { - expect(zipObject(['a', 'b', 'c'], [1, 2]), {a: 1, b: 2, c: undefined}).toEqual() +test('zipObject([a, b, c], [1, 2]) returns {a: 1, b: 2, c: undefined}', () => { + expect(zipObject(['a', 'b', 'c'], [1, 2])).toEqual({a: 1, b: 2, c: undefined}); }); - test('zipObject([a, b], [1, 2, 3]) returns {a: 1, b: 2}', () => { - expect(zipObject(['a', 'b'], [1, 2, 3]), {a: 1, b: 2}).toEqual() +test('zipObject([a, b], [1, 2, 3]) returns {a: 1, b: 2}', () => { + expect(zipObject(['a', 'b'], [1, 2, 3])).toEqual({a: 1, b: 2}); }); - test('zipObject([a, b, c], string) returns { a: s, b: t, c: r }', () => { - expect(zipObject(['a', 'b', 'c'], 'string'), { a: 's', b: 't', c: 'r' }).toEqual() +test('zipObject([a, b, c], string) returns { a: s, b: t, c: r }', () => { + expect(zipObject(['a', 'b', 'c'], 'string')).toEqual({ a: 's', b: 't', c: 'r' }); }); - test('zipObject([a], string) returns { a: s }', () => { - expect(zipObject(['a'], 'string'), { a: 's' }).toEqual() +test('zipObject([a], string) returns { a: s }', () => { + expect(zipObject(['a'], 'string')).toEqual({ a: 's' }); +}); +test('zipObject() throws an error', () => { + expect(zipObject()).toThrow(); +}); +test('zipObject(([\'string\'], null) throws an error', () => { + expect(zipObject((['string'], null)).toThrow(); +}); +test('zipObject(null, [1]) throws an error', () => { + expect(zipObject(null, [1])).toThrow(); +}); +test('zipObject(\'string\') throws an error', () => { + expect(zipObject('string')).toThrow(); +}); +test('zipObject(\'test\', \'string\') throws an error', () => { + expect(zipObject('test', 'string')).toThrow(); }); - t.throws(() => zipObject(), 'zipObject() throws an error'); - t.throws(() => zipObject(['string'], null), 'zipObject([string], null) throws an error'); - t.throws(() => zipObject(null, [1]), 'zipObject(null, [1]) throws an error'); - t.throws(() => zipObject('string'), 'zipObject(string) throws an error'); - t.throws(() => zipObject('test', 'string'), 'zipObject(test, string) throws an error'); - - - diff --git a/test/zipWith/zipWith.test.js b/test/zipWith/zipWith.test.js index f5e60492e..3cffd0a46 100644 --- a/test/zipWith/zipWith.test.js +++ b/test/zipWith/zipWith.test.js @@ -1,8 +1,6 @@ const expect = require('expect'); const zipWith = require('./zipWith.js'); - - test('zipWith is a Function', () => { +test('zipWith is a Function', () => { expect(zipWith).toBeInstanceOf(Function); }); -