Generated test files for new snippets

This commit is contained in:
Angelos Chalaris
2018-01-24 16:48:43 +02:00
parent f738884baf
commit 16b0701084
23 changed files with 229 additions and 5 deletions

2
test/ary/ary.js Normal file
View File

@ -0,0 +1,2 @@
const ary = (fn, n) => (...args) => fn(...args.slice(0, n));
module.exports = ary

13
test/ary/ary.test.js Normal file
View File

@ -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();
});

5
test/bind/bind.js Normal file
View File

@ -0,0 +1,5 @@
const bind = (fn, context, ...args) =>
function() {
return fn.apply(context, args.concat(...arguments));
};
module.exports = bind

13
test/bind/bind.test.js Normal file
View File

@ -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();
});

5
test/bindKey/bindKey.js Normal file
View File

@ -0,0 +1,5 @@
const bindKey = (context, fn, ...args) =>
function() {
return context[fn].apply(context, args.concat(...arguments));
};
module.exports = bindKey

View File

@ -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();
});

2
test/delay/delay.js Normal file
View File

@ -0,0 +1,2 @@
const delay = (fn, wait, ...args) => setTimeout(fn, wait, ...args);
module.exports = delay

13
test/delay/delay.test.js Normal file
View File

@ -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();
});

2
test/partial/partial.js Normal file
View File

@ -0,0 +1,2 @@
const partial = (fn, ...partials) => (...args) => fn(...partials, ...args);
module.exports = partial

View File

@ -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();
});

View File

@ -0,0 +1,2 @@
const partialRight = (fn, ...partials) => (...args) => fn(...args, ...partials);
module.exports = partialRight

View File

@ -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();
});

View File

@ -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

View File

@ -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();
});

View File

@ -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 > 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 √ arrayToHtmlList is a Function
Testing ary
√ ary is a Function
Testing atob Testing atob
√ atob is a Function √ 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 √ binarySearch is a Function
Testing bind
√ bind is a Function
Testing bindKey
√ bindKey is a Function
Testing bottomVisible Testing bottomVisible
√ bottomVisible is a Function √ 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 √ defer is a Function
Testing delay
√ delay is a Function
Testing detectDeviceType Testing detectDeviceType
√ detectDeviceType is a Function √ 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 √ parseCookie is a Function
Testing partial
√ partial is a Function
Testing partialRight
√ partialRight is a Function
Testing partition Testing partition
√ partition is a Function √ 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 √ reducedFilter is a Function
√ Filter an array of objects based on a condition while also filtering out unspecified keys. √ Filter an array of objects based on a condition while also filtering out unspecified keys.
Testing reduceSuccessive
√ reduceSuccessive is a Function
Testing remove Testing remove
√ remove is a Function √ 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
√ 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 Testing timeTaken
√ timeTaken is a Function √ 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 √ truthCheckCollection is a Function
√ second argument is truthy on all elements of a collection √ second argument is truthy on all elements of a collection
Testing unary
√ unary is a Function
Testing unescapeHTML Testing unescapeHTML
√ unescapeHTML is a Function √ unescapeHTML is a Function
√ Unescapes escaped HTML characters. √ Unescapes escaped HTML characters.
Testing unfold
√ unfold is a Function
Testing union Testing union
√ union is a Function √ 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([]) throws a error
√ words(1234) throws a error √ words(1234) throws a error
Testing xProd
√ xProd is a Function
Testing yesNo Testing yesNo
√ yesNo is a Function √ 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 √ zipWith is a Function
total: 587 total: 598
passing: 587 passing: 598
duration: 520ms duration: 1.3s

5
test/times/times.js Normal file
View File

@ -0,0 +1,5 @@
const times = (n, fn, context = undefined) => {
let i = 0;
while (fn.call(context, i) !== false && ++i < n) {}
};
module.exports = times

13
test/times/times.test.js Normal file
View File

@ -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();
});

2
test/unary/unary.js Normal file
View File

@ -0,0 +1,2 @@
const unary = fn => val => fn(val);
module.exports = unary

13
test/unary/unary.test.js Normal file
View File

@ -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();
});

7
test/unfold/unfold.js Normal file
View File

@ -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

View File

@ -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();
});

2
test/xProd/xProd.js Normal file
View File

@ -0,0 +1,2 @@
const xProd = (a, b) => a.map(x => b.map(y => [x, y]));
module.exports = xProd

13
test/xProd/xProd.test.js Normal file
View File

@ -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();
});