From 9534cdba4f92fa33943424ea558fb3792eb607f9 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Wed, 24 Jan 2018 16:48:43 +0200 Subject: [PATCH] Generated test files for new snippets --- test/ary/ary.js | 2 + test/ary/ary.test.js | 13 +++++ test/bind/bind.js | 5 ++ test/bind/bind.test.js | 13 +++++ test/bindKey/bindKey.js | 5 ++ test/bindKey/bindKey.test.js | 13 +++++ test/delay/delay.js | 2 + test/delay/delay.test.js | 13 +++++ test/partial/partial.js | 2 + test/partial/partial.test.js | 13 +++++ test/partialRight/partialRight.js | 2 + test/partialRight/partialRight.test.js | 13 +++++ test/reduceSuccessive/reduceSuccessive.js | 3 ++ .../reduceSuccessive/reduceSuccessive.test.js | 13 +++++ test/testlog | 54 +++++++++++++++++-- test/times/times.js | 5 ++ test/times/times.test.js | 13 +++++ test/unary/unary.js | 2 + test/unary/unary.test.js | 13 +++++ test/unfold/unfold.js | 7 +++ test/unfold/unfold.test.js | 13 +++++ test/xProd/xProd.js | 2 + test/xProd/xProd.test.js | 13 +++++ 23 files changed, 229 insertions(+), 5 deletions(-) create mode 100644 test/ary/ary.js create mode 100644 test/ary/ary.test.js create mode 100644 test/bind/bind.js create mode 100644 test/bind/bind.test.js create mode 100644 test/bindKey/bindKey.js create mode 100644 test/bindKey/bindKey.test.js create mode 100644 test/delay/delay.js create mode 100644 test/delay/delay.test.js create mode 100644 test/partial/partial.js create mode 100644 test/partial/partial.test.js create mode 100644 test/partialRight/partialRight.js create mode 100644 test/partialRight/partialRight.test.js create mode 100644 test/reduceSuccessive/reduceSuccessive.js create mode 100644 test/reduceSuccessive/reduceSuccessive.test.js create mode 100644 test/times/times.js create mode 100644 test/times/times.test.js create mode 100644 test/unary/unary.js create mode 100644 test/unary/unary.test.js create mode 100644 test/unfold/unfold.js create mode 100644 test/unfold/unfold.test.js create mode 100644 test/xProd/xProd.js create mode 100644 test/xProd/xProd.test.js diff --git a/test/ary/ary.js b/test/ary/ary.js new file mode 100644 index 000000000..25aa3b39a --- /dev/null +++ b/test/ary/ary.js @@ -0,0 +1,2 @@ +const ary = (fn, n) => (...args) => fn(...args.slice(0, n)); +module.exports = ary \ No newline at end of file diff --git a/test/ary/ary.test.js b/test/ary/ary.test.js new file mode 100644 index 000000000..d82728ce4 --- /dev/null +++ b/test/ary/ary.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const ary = require('./ary.js'); + +test('Testing ary', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof ary === 'function', 'ary is a Function'); + //t.deepEqual(ary(args..), 'Expected'); + //t.equal(ary(args..), 'Expected'); + //t.false(ary(args..), 'Expected'); + //t.throws(ary(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/bind/bind.js b/test/bind/bind.js new file mode 100644 index 000000000..63499a7d0 --- /dev/null +++ b/test/bind/bind.js @@ -0,0 +1,5 @@ +const bind = (fn, context, ...args) => +function() { +return fn.apply(context, args.concat(...arguments)); +}; +module.exports = bind \ No newline at end of file diff --git a/test/bind/bind.test.js b/test/bind/bind.test.js new file mode 100644 index 000000000..13df8d07a --- /dev/null +++ b/test/bind/bind.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const bind = require('./bind.js'); + +test('Testing bind', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof bind === 'function', 'bind is a Function'); + //t.deepEqual(bind(args..), 'Expected'); + //t.equal(bind(args..), 'Expected'); + //t.false(bind(args..), 'Expected'); + //t.throws(bind(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/bindKey/bindKey.js b/test/bindKey/bindKey.js new file mode 100644 index 000000000..72d491b73 --- /dev/null +++ b/test/bindKey/bindKey.js @@ -0,0 +1,5 @@ +const bindKey = (context, fn, ...args) => +function() { +return context[fn].apply(context, args.concat(...arguments)); +}; +module.exports = bindKey \ No newline at end of file diff --git a/test/bindKey/bindKey.test.js b/test/bindKey/bindKey.test.js new file mode 100644 index 000000000..91de08165 --- /dev/null +++ b/test/bindKey/bindKey.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const bindKey = require('./bindKey.js'); + +test('Testing bindKey', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof bindKey === 'function', 'bindKey is a Function'); + //t.deepEqual(bindKey(args..), 'Expected'); + //t.equal(bindKey(args..), 'Expected'); + //t.false(bindKey(args..), 'Expected'); + //t.throws(bindKey(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/delay/delay.js b/test/delay/delay.js new file mode 100644 index 000000000..2c5f8ef20 --- /dev/null +++ b/test/delay/delay.js @@ -0,0 +1,2 @@ +const delay = (fn, wait, ...args) => setTimeout(fn, wait, ...args); +module.exports = delay \ No newline at end of file diff --git a/test/delay/delay.test.js b/test/delay/delay.test.js new file mode 100644 index 000000000..31c2d875a --- /dev/null +++ b/test/delay/delay.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const delay = require('./delay.js'); + +test('Testing delay', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof delay === 'function', 'delay is a Function'); + //t.deepEqual(delay(args..), 'Expected'); + //t.equal(delay(args..), 'Expected'); + //t.false(delay(args..), 'Expected'); + //t.throws(delay(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/partial/partial.js b/test/partial/partial.js new file mode 100644 index 000000000..c6e9b012a --- /dev/null +++ b/test/partial/partial.js @@ -0,0 +1,2 @@ +const partial = (fn, ...partials) => (...args) => fn(...partials, ...args); +module.exports = partial \ No newline at end of file diff --git a/test/partial/partial.test.js b/test/partial/partial.test.js new file mode 100644 index 000000000..d8304f016 --- /dev/null +++ b/test/partial/partial.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const partial = require('./partial.js'); + +test('Testing partial', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof partial === 'function', 'partial is a Function'); + //t.deepEqual(partial(args..), 'Expected'); + //t.equal(partial(args..), 'Expected'); + //t.false(partial(args..), 'Expected'); + //t.throws(partial(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/partialRight/partialRight.js b/test/partialRight/partialRight.js new file mode 100644 index 000000000..20b89052d --- /dev/null +++ b/test/partialRight/partialRight.js @@ -0,0 +1,2 @@ +const partialRight = (fn, ...partials) => (...args) => fn(...args, ...partials); +module.exports = partialRight \ No newline at end of file diff --git a/test/partialRight/partialRight.test.js b/test/partialRight/partialRight.test.js new file mode 100644 index 000000000..749a80244 --- /dev/null +++ b/test/partialRight/partialRight.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const partialRight = require('./partialRight.js'); + +test('Testing partialRight', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof partialRight === 'function', 'partialRight is a Function'); + //t.deepEqual(partialRight(args..), 'Expected'); + //t.equal(partialRight(args..), 'Expected'); + //t.false(partialRight(args..), 'Expected'); + //t.throws(partialRight(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/reduceSuccessive/reduceSuccessive.js b/test/reduceSuccessive/reduceSuccessive.js new file mode 100644 index 000000000..67a9d03b3 --- /dev/null +++ b/test/reduceSuccessive/reduceSuccessive.js @@ -0,0 +1,3 @@ +const reduceSuccessive = (arr, fn, acc) => +arr.reduce((res, val, i, arr) => (res.push(fn(res.slice(-1)[0], val, i, arr)), res), [acc]); +module.exports = reduceSuccessive \ No newline at end of file diff --git a/test/reduceSuccessive/reduceSuccessive.test.js b/test/reduceSuccessive/reduceSuccessive.test.js new file mode 100644 index 000000000..2cd1bc2d5 --- /dev/null +++ b/test/reduceSuccessive/reduceSuccessive.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const reduceSuccessive = require('./reduceSuccessive.js'); + +test('Testing reduceSuccessive', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof reduceSuccessive === 'function', 'reduceSuccessive is a Function'); + //t.deepEqual(reduceSuccessive(args..), 'Expected'); + //t.equal(reduceSuccessive(args..), 'Expected'); + //t.false(reduceSuccessive(args..), 'Expected'); + //t.throws(reduceSuccessive(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/testlog b/test/testlog index b864db66f..ec65e3ba3 100644 --- a/test/testlog +++ b/test/testlog @@ -1,6 +1,6 @@ -Test log for: Wed Jan 24 2018 06:31:13 GMT-0500 (Eastern Standard Time) +Test log for: Wed Jan 24 2018 16:47:50 GMT+0200 (GTB Standard Time) -> 30-seconds-of-code@0.0.1 test C:\Users\King David\Desktop\github-repo\30-seconds-of-code +> 30-seconds-of-code@0.0.1 test G:\My Files\git Repositories\30-seconds-of-code > tape test/**/*.test.js | tap-spec @@ -13,6 +13,10 @@ Test log for: Wed Jan 24 2018 06:31:13 GMT-0500 (Eastern Standard Time) √ arrayToHtmlList is a Function + Testing ary + + √ ary is a Function + Testing atob √ atob is a Function @@ -40,6 +44,14 @@ Test log for: Wed Jan 24 2018 06:31:13 GMT-0500 (Eastern Standard Time) √ binarySearch is a Function + Testing bind + + √ bind is a Function + + Testing bindKey + + √ bindKey is a Function + Testing bottomVisible √ bottomVisible is a Function @@ -194,6 +206,10 @@ Test log for: Wed Jan 24 2018 06:31:13 GMT-0500 (Eastern Standard Time) √ defer is a Function + Testing delay + + √ delay is a Function + Testing detectDeviceType √ detectDeviceType is a Function @@ -906,6 +922,14 @@ Test log for: Wed Jan 24 2018 06:31:13 GMT-0500 (Eastern Standard Time) √ parseCookie is a Function + Testing partial + + √ partial is a Function + + Testing partialRight + + √ partialRight is a Function + Testing partition √ partition is a Function @@ -1011,6 +1035,10 @@ Test log for: Wed Jan 24 2018 06:31:13 GMT-0500 (Eastern Standard Time) √ reducedFilter is a Function √ Filter an array of objects based on a condition while also filtering out unspecified keys. + Testing reduceSuccessive + + √ reduceSuccessive is a Function + Testing remove √ remove is a Function @@ -1181,6 +1209,10 @@ Test log for: Wed Jan 24 2018 06:31:13 GMT-0500 (Eastern Standard Time) √ Returns an array with n elements removed from the end √ Returns an array with n elements removed from the end + Testing times + + √ times is a Function + Testing timeTaken √ timeTaken is a Function @@ -1253,11 +1285,19 @@ Test log for: Wed Jan 24 2018 06:31:13 GMT-0500 (Eastern Standard Time) √ truthCheckCollection is a Function √ second argument is truthy on all elements of a collection + Testing unary + + √ unary is a Function + Testing unescapeHTML √ unescapeHTML is a Function √ Unescapes escaped HTML characters. + Testing unfold + + √ unfold is a Function + Testing union √ union is a Function @@ -1344,6 +1384,10 @@ Test log for: Wed Jan 24 2018 06:31:13 GMT-0500 (Eastern Standard Time) √ words([]) throws a error √ words(1234) throws a error + Testing xProd + + √ xProd is a Function + Testing yesNo √ yesNo is a Function @@ -1390,8 +1434,8 @@ Test log for: Wed Jan 24 2018 06:31:13 GMT-0500 (Eastern Standard Time) √ zipWith is a Function - total: 587 - passing: 587 - duration: 520ms + total: 598 + passing: 598 + duration: 1.3s diff --git a/test/times/times.js b/test/times/times.js new file mode 100644 index 000000000..8866d35b4 --- /dev/null +++ b/test/times/times.js @@ -0,0 +1,5 @@ +const times = (n, fn, context = undefined) => { +let i = 0; +while (fn.call(context, i) !== false && ++i < n) {} +}; +module.exports = times \ No newline at end of file diff --git a/test/times/times.test.js b/test/times/times.test.js new file mode 100644 index 000000000..72b659376 --- /dev/null +++ b/test/times/times.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const times = require('./times.js'); + +test('Testing times', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof times === 'function', 'times is a Function'); + //t.deepEqual(times(args..), 'Expected'); + //t.equal(times(args..), 'Expected'); + //t.false(times(args..), 'Expected'); + //t.throws(times(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/unary/unary.js b/test/unary/unary.js new file mode 100644 index 000000000..524eb0113 --- /dev/null +++ b/test/unary/unary.js @@ -0,0 +1,2 @@ +const unary = fn => val => fn(val); +module.exports = unary \ No newline at end of file diff --git a/test/unary/unary.test.js b/test/unary/unary.test.js new file mode 100644 index 000000000..d741e1c39 --- /dev/null +++ b/test/unary/unary.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const unary = require('./unary.js'); + +test('Testing unary', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof unary === 'function', 'unary is a Function'); + //t.deepEqual(unary(args..), 'Expected'); + //t.equal(unary(args..), 'Expected'); + //t.false(unary(args..), 'Expected'); + //t.throws(unary(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/unfold/unfold.js b/test/unfold/unfold.js new file mode 100644 index 000000000..499ad0ab6 --- /dev/null +++ b/test/unfold/unfold.js @@ -0,0 +1,7 @@ +const unfold = (fn, seed) => { +let result = [], +val = [null, seed]; +while ((val = fn(val[1]))) result.push(val[0]); +return result; +}; +module.exports = unfold \ No newline at end of file diff --git a/test/unfold/unfold.test.js b/test/unfold/unfold.test.js new file mode 100644 index 000000000..d13332937 --- /dev/null +++ b/test/unfold/unfold.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const unfold = require('./unfold.js'); + +test('Testing unfold', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof unfold === 'function', 'unfold is a Function'); + //t.deepEqual(unfold(args..), 'Expected'); + //t.equal(unfold(args..), 'Expected'); + //t.false(unfold(args..), 'Expected'); + //t.throws(unfold(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/xProd/xProd.js b/test/xProd/xProd.js new file mode 100644 index 000000000..07ea52dfa --- /dev/null +++ b/test/xProd/xProd.js @@ -0,0 +1,2 @@ +const xProd = (a, b) => a.map(x => b.map(y => [x, y])); +module.exports = xProd \ No newline at end of file diff --git a/test/xProd/xProd.test.js b/test/xProd/xProd.test.js new file mode 100644 index 000000000..a164210a2 --- /dev/null +++ b/test/xProd/xProd.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const xProd = require('./xProd.js'); + +test('Testing xProd', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof xProd === 'function', 'xProd is a Function'); + //t.deepEqual(xProd(args..), 'Expected'); + //t.equal(xProd(args..), 'Expected'); + //t.false(xProd(args..), 'Expected'); + //t.throws(xProd(args..), 'Expected'); + t.end(); +}); \ No newline at end of file