Merge pull request #522 from Chalarangelo/snippet-tests
[FEATURE] Add few tests
This commit is contained in:
6
package-lock.json
generated
6
package-lock.json
generated
@ -1323,6 +1323,7 @@
|
|||||||
"version": "1.7.1",
|
"version": "1.7.1",
|
||||||
"resolved": "https://registry.npmjs.org/clipboard/-/clipboard-1.7.1.tgz",
|
"resolved": "https://registry.npmjs.org/clipboard/-/clipboard-1.7.1.tgz",
|
||||||
"integrity": "sha1-Ng1taUbpmnof7zleQrqStem1oWs=",
|
"integrity": "sha1-Ng1taUbpmnof7zleQrqStem1oWs=",
|
||||||
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"good-listener": "1.2.2",
|
"good-listener": "1.2.2",
|
||||||
@ -1601,6 +1602,7 @@
|
|||||||
"version": "3.2.0",
|
"version": "3.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz",
|
||||||
"integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==",
|
"integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==",
|
||||||
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"delegates": {
|
"delegates": {
|
||||||
@ -2388,6 +2390,7 @@
|
|||||||
"version": "1.2.2",
|
"version": "1.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz",
|
||||||
"integrity": "sha1-1TswzfkxPf+33JoNR3CWqm0UXFA=",
|
"integrity": "sha1-1TswzfkxPf+33JoNR3CWqm0UXFA=",
|
||||||
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"delegate": "3.2.0"
|
"delegate": "3.2.0"
|
||||||
@ -3700,6 +3703,7 @@
|
|||||||
"version": "1.9.0",
|
"version": "1.9.0",
|
||||||
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.9.0.tgz",
|
||||||
"integrity": "sha1-+j4tntw8OIfB8fMJXUHx+bQgDw8=",
|
"integrity": "sha1-+j4tntw8OIfB8fMJXUHx+bQgDw8=",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"clipboard": "1.7.1"
|
"clipboard": "1.7.1"
|
||||||
}
|
}
|
||||||
@ -4113,6 +4117,7 @@
|
|||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz",
|
||||||
"integrity": "sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0=",
|
"integrity": "sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0=",
|
||||||
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"semistandard": {
|
"semistandard": {
|
||||||
@ -4570,6 +4575,7 @@
|
|||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.0.2.tgz",
|
||||||
"integrity": "sha512-2NM0auVBGft5tee/OxP4PI3d8WItkDM+fPnaRAVo6xTDI2knbz9eC5ArWGqtGlYqiH3RU5yMpdyTTO7MguC4ow==",
|
"integrity": "sha512-2NM0auVBGft5tee/OxP4PI3d8WItkDM+fPnaRAVo6xTDI2knbz9eC5ArWGqtGlYqiH3RU5yMpdyTTO7MguC4ow==",
|
||||||
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"to-fast-properties": {
|
"to-fast-properties": {
|
||||||
|
|||||||
@ -5,8 +5,8 @@ test('Testing isDivisible', (t) => {
|
|||||||
//For more information on all the methods supported by tape
|
//For more information on all the methods supported by tape
|
||||||
//Please go to https://github.com/substack/tape
|
//Please go to https://github.com/substack/tape
|
||||||
t.true(typeof isDivisible === 'function', 'isDivisible is a Function');
|
t.true(typeof isDivisible === 'function', 'isDivisible is a Function');
|
||||||
|
t.equal(isDivisible(6, 3), true, 'The number 6 is divisible by 3');
|
||||||
//t.deepEqual(isDivisible(args..), 'Expected');
|
//t.deepEqual(isDivisible(args..), 'Expected');
|
||||||
//t.equal(isDivisible(args..), 'Expected');
|
|
||||||
//t.false(isDivisible(args..), 'Expected');
|
//t.false(isDivisible(args..), 'Expected');
|
||||||
//t.throws(isDivisible(args..), 'Expected');
|
//t.throws(isDivisible(args..), 'Expected');
|
||||||
t.end();
|
t.end();
|
||||||
|
|||||||
@ -5,9 +5,9 @@ test('Testing isEven', (t) => {
|
|||||||
//For more information on all the methods supported by tape
|
//For more information on all the methods supported by tape
|
||||||
//Please go to https://github.com/substack/tape
|
//Please go to https://github.com/substack/tape
|
||||||
t.true(typeof isEven === 'function', 'isEven is a Function');
|
t.true(typeof isEven === 'function', 'isEven is a Function');
|
||||||
|
t.equal(isEven(4), true, '4 is even number');
|
||||||
|
t.false(isEven(5), false, '5 is not an even number');
|
||||||
//t.deepEqual(isEven(args..), 'Expected');
|
//t.deepEqual(isEven(args..), 'Expected');
|
||||||
//t.equal(isEven(args..), 'Expected');
|
|
||||||
//t.false(isEven(args..), 'Expected');
|
|
||||||
//t.throws(isEven(args..), 'Expected');
|
//t.throws(isEven(args..), 'Expected');
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
@ -6,7 +6,9 @@ test('Testing isSorted', (t) => {
|
|||||||
//Please go to https://github.com/substack/tape
|
//Please go to https://github.com/substack/tape
|
||||||
t.true(typeof isSorted === 'function', 'isSorted is a Function');
|
t.true(typeof isSorted === 'function', 'isSorted is a Function');
|
||||||
//t.deepEqual(isSorted(args..), 'Expected');
|
//t.deepEqual(isSorted(args..), 'Expected');
|
||||||
//t.equal(isSorted(args..), 'Expected');
|
t.equal(isSorted([0, 1, 2, 2]), 1, 'Array is sorted in ascending order');
|
||||||
|
t.equal(isSorted([4, 3, 2]), -1, 'Array is sorted in descending order');
|
||||||
|
t.equal(isSorted([4, 3, 5]), 0, 'Array is not sorted, direction changed in array')
|
||||||
//t.false(isSorted(args..), 'Expected');
|
//t.false(isSorted(args..), 'Expected');
|
||||||
//t.throws(isSorted(args..), 'Expected');
|
//t.throws(isSorted(args..), 'Expected');
|
||||||
t.end();
|
t.end();
|
||||||
|
|||||||
@ -5,6 +5,12 @@ test('Testing isString', (t) => {
|
|||||||
//For more information on all the methods supported by tape
|
//For more information on all the methods supported by tape
|
||||||
//Please go to https://github.com/substack/tape
|
//Please go to https://github.com/substack/tape
|
||||||
t.true(typeof isString === 'function', 'isString is a Function');
|
t.true(typeof isString === 'function', 'isString is a Function');
|
||||||
|
t.equal(isString('foo'), true, 'foo is a string');
|
||||||
|
t.equal(isString('10'), true, '"10" is a string');
|
||||||
|
t.equal(isString(''), true, 'Empty string is a string');
|
||||||
|
t.equal(isString(10), false, '10 is not a string');
|
||||||
|
t.equal(isString(true), false, 'true is not string');
|
||||||
|
|
||||||
//t.deepEqual(isString(args..), 'Expected');
|
//t.deepEqual(isString(args..), 'Expected');
|
||||||
//t.equal(isString(args..), 'Expected');
|
//t.equal(isString(args..), 'Expected');
|
||||||
//t.false(isString(args..), 'Expected');
|
//t.false(isString(args..), 'Expected');
|
||||||
|
|||||||
@ -6,7 +6,9 @@ test('Testing isUpperCase', (t) => {
|
|||||||
//Please go to https://github.com/substack/tape
|
//Please go to https://github.com/substack/tape
|
||||||
t.true(typeof isUpperCase === 'function', 'isUpperCase is a Function');
|
t.true(typeof isUpperCase === 'function', 'isUpperCase is a Function');
|
||||||
//t.deepEqual(isUpperCase(args..), 'Expected');
|
//t.deepEqual(isUpperCase(args..), 'Expected');
|
||||||
//t.equal(isUpperCase(args..), 'Expected');
|
t.equal(isUpperCase('ABC'), true, 'ABC is all upper case');
|
||||||
|
t.equal(isUpperCase('abc'), false, 'abc is not all upper case');
|
||||||
|
t.equal(isUpperCase('A3@$'), true, 'A3@$ is all uppercase');
|
||||||
//t.false(isUpperCase(args..), 'Expected');
|
//t.false(isUpperCase(args..), 'Expected');
|
||||||
//t.throws(isUpperCase(args..), 'Expected');
|
//t.throws(isUpperCase(args..), 'Expected');
|
||||||
t.end();
|
t.end();
|
||||||
|
|||||||
@ -5,6 +5,9 @@ test('Testing isValidJSON', (t) => {
|
|||||||
//For more information on all the methods supported by tape
|
//For more information on all the methods supported by tape
|
||||||
//Please go to https://github.com/substack/tape
|
//Please go to https://github.com/substack/tape
|
||||||
t.true(typeof isValidJSON === 'function', 'isValidJSON is a Function');
|
t.true(typeof isValidJSON === 'function', 'isValidJSON is a Function');
|
||||||
|
t.equal(isValidJSON('{"name":"Adam","age":20}'), true, '{"name":"Adam","age":20} is a valid JSON');
|
||||||
|
t.equal(isValidJSON('{"name":"Adam",age:"20"}'), false, '{"name":"Adam",age:"20"} is not a valid JSON');
|
||||||
|
t.equal(isValidJSON(null), true, 'null is a valid JSON');
|
||||||
//t.deepEqual(isValidJSON(args..), 'Expected');
|
//t.deepEqual(isValidJSON(args..), 'Expected');
|
||||||
//t.equal(isValidJSON(args..), 'Expected');
|
//t.equal(isValidJSON(args..), 'Expected');
|
||||||
//t.false(isValidJSON(args..), 'Expected');
|
//t.false(isValidJSON(args..), 'Expected');
|
||||||
|
|||||||
@ -5,6 +5,11 @@ test('Testing toOrdinalSuffix', (t) => {
|
|||||||
//For more information on all the methods supported by tape
|
//For more information on all the methods supported by tape
|
||||||
//Please go to https://github.com/substack/tape
|
//Please go to https://github.com/substack/tape
|
||||||
t.true(typeof toOrdinalSuffix === 'function', 'toOrdinalSuffix is a Function');
|
t.true(typeof toOrdinalSuffix === 'function', 'toOrdinalSuffix is a Function');
|
||||||
|
t.equal(toOrdinalSuffix('123'), '123rd', 'Adds an ordinal suffix to a number');
|
||||||
|
t.equal(toOrdinalSuffix(5), '5th', 'Adds an ordinal suffix to a number');
|
||||||
|
t.equal(toOrdinalSuffix(1), '1st', 'Adds an ordinal suffix to a number');
|
||||||
|
t.equal(toOrdinalSuffix(0), '0th', 'Adds an ordinal suffix to a number');
|
||||||
|
// t.equal(toOrdinalSuffix(), ,);
|
||||||
//t.deepEqual(toOrdinalSuffix(args..), 'Expected');
|
//t.deepEqual(toOrdinalSuffix(args..), 'Expected');
|
||||||
//t.equal(toOrdinalSuffix(args..), 'Expected');
|
//t.equal(toOrdinalSuffix(args..), 'Expected');
|
||||||
//t.false(toOrdinalSuffix(args..), 'Expected');
|
//t.false(toOrdinalSuffix(args..), 'Expected');
|
||||||
|
|||||||
@ -5,6 +5,11 @@ test('Testing toSafeInteger', (t) => {
|
|||||||
//For more information on all the methods supported by tape
|
//For more information on all the methods supported by tape
|
||||||
//Please go to https://github.com/substack/tape
|
//Please go to https://github.com/substack/tape
|
||||||
t.true(typeof toSafeInteger === 'function', 'toSafeInteger is a Function');
|
t.true(typeof toSafeInteger === 'function', 'toSafeInteger is a Function');
|
||||||
|
t.equal(toSafeInteger(3.2), 3, "Converts a value to a safe integer");
|
||||||
|
t.equal(toSafeInteger('4.2'), 4, "Converts a value to a safe integer");
|
||||||
|
t.equal(toSafeInteger(4.6), 5, "Converts a value to a safe integer");
|
||||||
|
t.equal(toSafeInteger(1.5), 2, "Converts a value to a safe integer");
|
||||||
|
t.equal(toSafeInteger(Infinity), 9007199254740991, "Converts a value to a safe integer");
|
||||||
//t.deepEqual(toSafeInteger(args..), 'Expected');
|
//t.deepEqual(toSafeInteger(args..), 'Expected');
|
||||||
//t.equal(toSafeInteger(args..), 'Expected');
|
//t.equal(toSafeInteger(args..), 'Expected');
|
||||||
//t.false(toSafeInteger(args..), 'Expected');
|
//t.false(toSafeInteger(args..), 'Expected');
|
||||||
|
|||||||
@ -5,7 +5,7 @@ test('Testing truncateString', (t) => {
|
|||||||
//For more information on all the methods supported by tape
|
//For more information on all the methods supported by tape
|
||||||
//Please go to https://github.com/substack/tape
|
//Please go to https://github.com/substack/tape
|
||||||
t.true(typeof truncateString === 'function', 'truncateString is a Function');
|
t.true(typeof truncateString === 'function', 'truncateString is a Function');
|
||||||
//t.deepEqual(truncateString(args..), 'Expected');
|
t.equal(truncateString('boomerang', 7), 'boom...', 'Truncates a "boomerang" up to a specified length.');
|
||||||
//t.equal(truncateString(args..), 'Expected');
|
//t.equal(truncateString(args..), 'Expected');
|
||||||
//t.false(truncateString(args..), 'Expected');
|
//t.false(truncateString(args..), 'Expected');
|
||||||
//t.throws(truncateString(args..), 'Expected');
|
//t.throws(truncateString(args..), 'Expected');
|
||||||
|
|||||||
@ -5,6 +5,7 @@ test('Testing unescapeHTML', (t) => {
|
|||||||
//For more information on all the methods supported by tape
|
//For more information on all the methods supported by tape
|
||||||
//Please go to https://github.com/substack/tape
|
//Please go to https://github.com/substack/tape
|
||||||
t.true(typeof unescapeHTML === 'function', 'unescapeHTML is a Function');
|
t.true(typeof unescapeHTML === 'function', 'unescapeHTML is a Function');
|
||||||
|
t.equal(unescapeHTML('<a href="#">Me & you</a>'), '<a href="#">Me & you</a>', 'Unescapes escaped HTML characters.');
|
||||||
//t.deepEqual(unescapeHTML(args..), 'Expected');
|
//t.deepEqual(unescapeHTML(args..), 'Expected');
|
||||||
//t.equal(unescapeHTML(args..), 'Expected');
|
//t.equal(unescapeHTML(args..), 'Expected');
|
||||||
//t.false(unescapeHTML(args..), 'Expected');
|
//t.false(unescapeHTML(args..), 'Expected');
|
||||||
|
|||||||
@ -5,6 +5,7 @@ test('Testing validateNumber', (t) => {
|
|||||||
//For more information on all the methods supported by tape
|
//For more information on all the methods supported by tape
|
||||||
//Please go to https://github.com/substack/tape
|
//Please go to https://github.com/substack/tape
|
||||||
t.true(typeof validateNumber === 'function', 'validateNumber is a Function');
|
t.true(typeof validateNumber === 'function', 'validateNumber is a Function');
|
||||||
|
t.equal(validateNumber(9), true, '9 is a number');
|
||||||
//t.deepEqual(validateNumber(args..), 'Expected');
|
//t.deepEqual(validateNumber(args..), 'Expected');
|
||||||
//t.equal(validateNumber(args..), 'Expected');
|
//t.equal(validateNumber(args..), 'Expected');
|
||||||
//t.false(validateNumber(args..), 'Expected');
|
//t.false(validateNumber(args..), 'Expected');
|
||||||
|
|||||||
@ -5,6 +5,9 @@ test('Testing words', (t) => {
|
|||||||
//For more information on all the methods supported by tape
|
//For more information on all the methods supported by tape
|
||||||
//Please go to https://github.com/substack/tape
|
//Please go to https://github.com/substack/tape
|
||||||
t.true(typeof words === 'function', 'words is a Function');
|
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(args..), 'Expected');
|
//t.deepEqual(words(args..), 'Expected');
|
||||||
//t.equal(words(args..), 'Expected');
|
//t.equal(words(args..), 'Expected');
|
||||||
//t.false(words(args..), 'Expected');
|
//t.false(words(args..), 'Expected');
|
||||||
|
|||||||
@ -5,6 +5,11 @@ test('Testing yesNo', (t) => {
|
|||||||
//For more information on all the methods supported by tape
|
//For more information on all the methods supported by tape
|
||||||
//Please go to https://github.com/substack/tape
|
//Please go to https://github.com/substack/tape
|
||||||
t.true(typeof yesNo === 'function', 'yesNo is a Function');
|
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.deepEqual(yesNo(args..), 'Expected');
|
//t.deepEqual(yesNo(args..), 'Expected');
|
||||||
//t.equal(yesNo(args..), 'Expected');
|
//t.equal(yesNo(args..), 'Expected');
|
||||||
//t.false(yesNo(args..), 'Expected');
|
//t.false(yesNo(args..), 'Expected');
|
||||||
|
|||||||
Reference in New Issue
Block a user