Merge pull request #547 from Chalarangelo/test-recursive

[FEATURE]  Recursive snippets tests
This commit is contained in:
Angelos Chalaris
2018-01-15 22:17:34 +02:00
committed by GitHub
4 changed files with 13 additions and 8 deletions

View File

@ -5,6 +5,8 @@ test('Testing cleanObj', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof cleanObj === 'function', 'cleanObj is a Function');
const testObj = { a: 1, b: 2, children: { a: 1, b: 2 } };
t.deepEqual(cleanObj(testObj, ['a'], 'children'), { a: 1, children : { a: 1}}, "Removes any properties except the ones specified from a JSON object");
//t.deepEqual(cleanObj(args..), 'Expected');
//t.equal(cleanObj(args..), 'Expected');
//t.false(cleanObj(args..), 'Expected');

View File

@ -5,8 +5,8 @@ test('Testing curry', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof curry === 'function', 'curry is a Function');
//BROKEN
// t.equal(curry(Math.pow)(2)(10), 1024, "Curries a function");
t.equal(curry(Math.pow)(2)(10), 1024, "curries a Math.pow");
t.equal(curry(Math.min, 3)(10)(50)(2), 2, "curries a Math.min");
//t.deepEqual(curry(args..), 'Expected');
//t.equal(curry(args..), 'Expected');
//t.false(curry(args..), 'Expected');

View File

@ -4,11 +4,10 @@ const elo = require('./elo.js');
test('Testing elo', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
// BORKEN
// t.true(typeof elo === 'function', 'elo is a Function');
// t.deepEqual(elo([1200, 1200]), [1216, 1184], "Standard 1v1s");
// t.deepEqual(elo([1200, 1200], 64), [1232, 1168]), "Standard 1v1s";
// t.deepEqual(elo([1200, 1200, 1200, 1200]).map(Math.round), [1246, 1215, 1185, 1154], "4 player FFA, all same rank");
t.true(typeof elo === 'function', 'elo is a Function');
t.deepEqual(elo([1200, 1200]), [1216, 1184], "Standard 1v1s");
t.deepEqual(elo([1200, 1200], 64), [1232, 1168]), "Standard 1v1s";
t.deepEqual(elo([1200, 1200, 1200, 1200]).map(Math.round), [1246, 1215, 1185, 1154], "4 player FFA, all same rank");
//t.deepEqual(elo(args..), 'Expected');
//t.equal(elo(args..), 'Expected');
//t.false(elo(args..), 'Expected');

View File

@ -5,7 +5,11 @@ test('Testing factorial', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof factorial === 'function', 'factorial is a Function');
// t.equal(factorial(6), 720, "Calculates the factorial of a number"); DOESN'T WORK
t.equal(factorial(6), 720, "Calculates the factorial of 720");
t.equal(factorial(0), 1, "Calculates the factorial of 0");
t.equal(factorial(1), 1, "Calculates the factorial of 1");
t.equal(factorial(4), 24, "Calculates the factorial of 4");
t.equal(factorial(10), 3628800, "Calculates the factorial of 10");
//t.deepEqual(factorial(args..), 'Expected');
//t.equal(factorial(args..), 'Expected');
//t.false(factorial(args..), 'Expected');