@ -5,10 +5,18 @@ test('Testing validateNumber', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof validateNumber === 'function', 'validateNumber is a Function');
|
||||
t.equal(validateNumber(9), true, '9 is a number');
|
||||
//t.deepEqual(validateNumber(args..), 'Expected');
|
||||
//t.equal(validateNumber(args..), 'Expected');
|
||||
//t.false(validateNumber(args..), 'Expected');
|
||||
//t.throws(validateNumber(args..), 'Expected');
|
||||
t.true(validateNumber(9), 'validateNumber(9) returns true');
|
||||
t.true(validateNumber('234asd'.slice(0, 2)), 'validateNumber(234asd.slice(0, 2)) returns true');
|
||||
t.true(validateNumber(1232), 'validateNumber(1232) returns true');
|
||||
t.true(validateNumber(1232 + 13423), 'validateNumber(1232 + 13423) returns true');
|
||||
t.true(validateNumber(1232 * 2342 * 123), 'validateNumber(1232 * 2342 * 123) returns true');
|
||||
t.true(validateNumber(1232.23423536), 'validateNumber(1232.23423536) returns true');
|
||||
t.false(validateNumber('234asd'), 'validateNumber(234asd) returns false');
|
||||
t.false(validateNumber('e234d'), 'validateNumber(e234d) returns false');
|
||||
t.false(validateNumber(false), 'validateNumber(false) returns false');
|
||||
t.false(validateNumber(true), 'validateNumber(true) returns false');
|
||||
t.false(validateNumber(null), 'validateNumber(null) returns false');
|
||||
t.false(validateNumber(123 * 'asd'), 'validateNumber(123 * asd) returns false');
|
||||
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
@ -5,10 +5,15 @@ test('Testing without', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof without === 'function', 'without is a Function');
|
||||
t.deepEqual(without([2, 1, 2, 3], 1, 2), [3], "Filters out the elements of an array, that have one of the specified values.");
|
||||
//t.deepEqual(without(args..), 'Expected');
|
||||
//t.equal(without(args..), 'Expected');
|
||||
//t.false(without(args..), 'Expected');
|
||||
//t.throws(without(args..), 'Expected');
|
||||
t.deepEqual(without([2, 1, 2, 3], 1, 2), [3], "without([2, 1, 2, 3], 1, 2) returns [3]");
|
||||
t.deepEqual(without([]), [], "without([]) returns []");
|
||||
t.deepEqual(without([3, 1, true, '3', true], '3', true), [3, 1], "without([3, 1, true, '3', true], '3', true) returns [3, 1]");
|
||||
t.deepEqual(without('string'.split(''), 's', 't', 'g'), ['r', 'i', 'n'], "without('string'.split(''), 's', 't', 'g') returns ['r', 'i', 'n']");
|
||||
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');
|
||||
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
@ -5,12 +5,15 @@ test('Testing words', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof words === 'function', 'words is a Function');
|
||||
t.deepEqual(words('I love javaScript!!'), ["I", "love", "javaScript"], "Returns words from a string");
|
||||
t.deepEqual(words('python, javaScript & coffee'), ["python", "javaScript", "coffee"], "Returns words from a string");
|
||||
t.deepEqual(words('I love javaScript!!'), ["I", "love", "javaScript"], "words('I love javaScript!!') returns [I, love, javaScript]");
|
||||
t.deepEqual(words('python, javaScript & coffee'), ["python", "javaScript", "coffee"], "words('python, javaScript & coffee') returns [python, javaScript, coffee]");
|
||||
t.true(Array.isArray(words('I love javaScript!!')), 'words(I love javaScript!!) returns an array');
|
||||
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');
|
||||
|
||||
//t.deepEqual(words(args..), 'Expected');
|
||||
//t.equal(words(args..), 'Expected');
|
||||
//t.false(words(args..), 'Expected');
|
||||
//t.throws(words(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
@ -5,14 +5,18 @@ test('Testing yesNo', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof yesNo === 'function', 'yesNo is a Function');
|
||||
t.equal(yesNo('Y'), true, 'Returns true as the provided string is y/yes');
|
||||
t.equal(yesNo('yes'), true, 'Returns true as the provided string is y/yes');
|
||||
t.equal(yesNo('No'), false, 'Returns false as the provided string is n/no');
|
||||
t.equal(yesNo('foo', true), true, 'Returns true since the 2nd argument is ommited');
|
||||
t.true(yesNo('Y'), 'yesNo(Y) returns true');
|
||||
t.true(yesNo('yes'), 'yesNo(yes) returns true');
|
||||
t.true(yesNo('foo', true), 'yesNo(foo, true) returns true');
|
||||
t.false(yesNo('No'), 'yesNo(No) returns false');
|
||||
t.false(yesNo(), 'yesNo() returns false');
|
||||
t.false(yesNo(null), 'yesNo(null) returns false');
|
||||
t.false(yesNo(undefined), 'yesNo(undefined) returns false');
|
||||
t.false(yesNo([123, null]), 'yesNo([123, null]) returns false');
|
||||
t.false(yesNo(['Yes', 'No']), 'yesNo([Yes, No]) returns false');
|
||||
t.false(yesNo({ 2: 'Yes' }), 'yesNo({ 2: Yes }) returns false');
|
||||
t.true(yesNo(['Yes', 'No'], true), 'yesNo([Yes, No], true) returns true');
|
||||
t.true(yesNo({ 2: 'Yes' }, true), 'yesNo({ 2: Yes }, true) returns true');
|
||||
|
||||
//t.deepEqual(yesNo(args..), 'Expected');
|
||||
//t.equal(yesNo(args..), 'Expected');
|
||||
//t.false(yesNo(args..), 'Expected');
|
||||
//t.throws(yesNo(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
@ -5,11 +5,14 @@ test('Testing zip', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof zip === 'function', 'zip is a Function');
|
||||
t.deepEqual(zip(['a', 'b'], [1, 2], [true, false]), [['a', 1, true], ['b', 2, false]], 'Object was zipped');
|
||||
t.deepEqual(zip(['a'], [1, 2], [true, false]), [['a', 1, true], [undefined, 2, false]], 'Object was zipped');
|
||||
t.true(Array.isArray(zip(['a', 'b'], [1, 2], [true, false])), 'zip returns an Array');
|
||||
t.true(Array.isArray(zip(['a'], [1, 2], [true, false])), 'zip returns an Array');
|
||||
//t.false(zip(args..), 'Expected');
|
||||
//t.throws(zip(args..), 'Expected');
|
||||
t.deepEqual(zip(['a', 'b'], [1, 2], [true, false]), [['a', 1, true], ['b', 2, false]], 'zip([a, b], [1, 2], [true, false]) returns [[a, 1, true], [b, 2, false]]');
|
||||
t.deepEqual(zip(['a'], [1, 2], [true, false]), [['a', 1, true], [undefined, 2, false]], 'zip([a], [1, 2], [true, false]) returns [[a, 1, true], [undefined, 2, false]]');
|
||||
t.deepEqual(zip(), [], 'zip([]) returns []');
|
||||
t.deepEqual(zip(123), [], 'zip(123) returns []');
|
||||
t.true(Array.isArray(zip(['a', 'b'], [1, 2], [true, false])), 'zip([a, b], [1, 2], [true, false]) returns an Array');
|
||||
t.true(Array.isArray(zip(['a'], [1, 2], [true, false])), 'zip([a], [1, 2], [true, false]) returns an Array');
|
||||
t.throws(() => zip(null), 'zip(null) throws an error');
|
||||
t.throws(() => zip(undefined), 'zip(undefined) throws an error');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
@ -5,10 +5,15 @@ test('Testing zipObject', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof zipObject === 'function', 'zipObject is a Function');
|
||||
t.deepEqual(zipObject(['a', 'b', 'c'], [1, 2]), {a: 1, b: 2, c: undefined}, 'Array was zipped to object');
|
||||
t.deepEqual(zipObject(['a', 'b'], [1, 2, 3]), {a: 1, b: 2}, 'Array was zipped to object');
|
||||
//t.equal(zipObject(args..), 'Expected');
|
||||
//t.false(zipObject(args..), 'Expected');
|
||||
//t.throws(zipObject(args..), 'Expected');
|
||||
t.deepEqual(zipObject(['a', 'b', 'c'], [1, 2]), {a: 1, b: 2, c: undefined}, 'zipObject([a, b, c], [1, 2]) returns {a: 1, b: 2, c: undefined}');
|
||||
t.deepEqual(zipObject(['a', 'b'], [1, 2, 3]), {a: 1, b: 2}, 'zipObject([a, b], [1, 2, 3]) returns {a: 1, b: 2}');
|
||||
t.deepEqual(zipObject(['a', 'b', 'c'], 'string'), { a: 's', b: 't', c: 'r' }, 'zipObject([a, b, c], string) returns { a: s, b: t, c: r }');
|
||||
t.deepEqual(zipObject(['a'], 'string'), { a: 's' }, 'zipObject([a], string) returns { a: s }');
|
||||
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');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user