diff --git a/package-lock.json b/package-lock.json index 21f1a9c9c..551d294be 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1323,6 +1323,7 @@ "version": "1.7.1", "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-1.7.1.tgz", "integrity": "sha1-Ng1taUbpmnof7zleQrqStem1oWs=", + "dev": true, "optional": true, "requires": { "good-listener": "1.2.2", @@ -1601,6 +1602,7 @@ "version": "3.2.0", "resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz", "integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==", + "dev": true, "optional": true }, "delegates": { @@ -2388,6 +2390,7 @@ "version": "1.2.2", "resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz", "integrity": "sha1-1TswzfkxPf+33JoNR3CWqm0UXFA=", + "dev": true, "optional": true, "requires": { "delegate": "3.2.0" @@ -3700,6 +3703,7 @@ "version": "1.9.0", "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.9.0.tgz", "integrity": "sha1-+j4tntw8OIfB8fMJXUHx+bQgDw8=", + "dev": true, "requires": { "clipboard": "1.7.1" } @@ -4113,6 +4117,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz", "integrity": "sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0=", + "dev": true, "optional": true }, "semistandard": { @@ -4570,6 +4575,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.0.2.tgz", "integrity": "sha512-2NM0auVBGft5tee/OxP4PI3d8WItkDM+fPnaRAVo6xTDI2knbz9eC5ArWGqtGlYqiH3RU5yMpdyTTO7MguC4ow==", + "dev": true, "optional": true }, "to-fast-properties": { diff --git a/test/isDivisible/isDivisible.test.js b/test/isDivisible/isDivisible.test.js index be73cdba5..40eeb4bc9 100644 --- a/test/isDivisible/isDivisible.test.js +++ b/test/isDivisible/isDivisible.test.js @@ -5,8 +5,8 @@ test('Testing isDivisible', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape 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.equal(isDivisible(args..), 'Expected'); //t.false(isDivisible(args..), 'Expected'); //t.throws(isDivisible(args..), 'Expected'); t.end(); diff --git a/test/isEven/isEven.test.js b/test/isEven/isEven.test.js index d6a540d56..6436226b4 100644 --- a/test/isEven/isEven.test.js +++ b/test/isEven/isEven.test.js @@ -5,9 +5,9 @@ test('Testing isEven', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape 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.equal(isEven(args..), 'Expected'); - //t.false(isEven(args..), 'Expected'); //t.throws(isEven(args..), 'Expected'); t.end(); }); \ No newline at end of file diff --git a/test/isSorted/isSorted.test.js b/test/isSorted/isSorted.test.js index b41aef9ef..183435cd4 100644 --- a/test/isSorted/isSorted.test.js +++ b/test/isSorted/isSorted.test.js @@ -6,7 +6,9 @@ test('Testing isSorted', (t) => { //Please go to https://github.com/substack/tape t.true(typeof isSorted === 'function', 'isSorted is a Function'); //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.throws(isSorted(args..), 'Expected'); t.end(); diff --git a/test/isString/isString.test.js b/test/isString/isString.test.js index c3b892e27..7d47db410 100644 --- a/test/isString/isString.test.js +++ b/test/isString/isString.test.js @@ -5,6 +5,12 @@ test('Testing isString', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape 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.equal(isString(args..), 'Expected'); //t.false(isString(args..), 'Expected'); diff --git a/test/isUpperCase/isUpperCase.test.js b/test/isUpperCase/isUpperCase.test.js index 9bc274be5..e42088f8e 100644 --- a/test/isUpperCase/isUpperCase.test.js +++ b/test/isUpperCase/isUpperCase.test.js @@ -6,7 +6,9 @@ test('Testing isUpperCase', (t) => { //Please go to https://github.com/substack/tape t.true(typeof isUpperCase === 'function', 'isUpperCase is a Function'); //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.throws(isUpperCase(args..), 'Expected'); t.end(); diff --git a/test/isValidJSON/isValidJSON.test.js b/test/isValidJSON/isValidJSON.test.js index 31bb543a6..1c38c04d0 100644 --- a/test/isValidJSON/isValidJSON.test.js +++ b/test/isValidJSON/isValidJSON.test.js @@ -5,6 +5,9 @@ test('Testing isValidJSON', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape 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.equal(isValidJSON(args..), 'Expected'); //t.false(isValidJSON(args..), 'Expected'); diff --git a/test/toOrdinalSuffix/toOrdinalSuffix.test.js b/test/toOrdinalSuffix/toOrdinalSuffix.test.js index bc261a66c..d33dead0a 100644 --- a/test/toOrdinalSuffix/toOrdinalSuffix.test.js +++ b/test/toOrdinalSuffix/toOrdinalSuffix.test.js @@ -5,6 +5,11 @@ test('Testing toOrdinalSuffix', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape 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.equal(toOrdinalSuffix(args..), 'Expected'); //t.false(toOrdinalSuffix(args..), 'Expected'); diff --git a/test/toSafeInteger/toSafeInteger.test.js b/test/toSafeInteger/toSafeInteger.test.js index d60c7a9d9..e04013774 100644 --- a/test/toSafeInteger/toSafeInteger.test.js +++ b/test/toSafeInteger/toSafeInteger.test.js @@ -5,6 +5,11 @@ test('Testing toSafeInteger', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape 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.equal(toSafeInteger(args..), 'Expected'); //t.false(toSafeInteger(args..), 'Expected'); diff --git a/test/truncateString/truncateString.test.js b/test/truncateString/truncateString.test.js index 0b6ef0997..da3ce1d3c 100644 --- a/test/truncateString/truncateString.test.js +++ b/test/truncateString/truncateString.test.js @@ -5,7 +5,7 @@ test('Testing truncateString', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape 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.false(truncateString(args..), 'Expected'); //t.throws(truncateString(args..), 'Expected'); diff --git a/test/unescapeHTML/unescapeHTML.test.js b/test/unescapeHTML/unescapeHTML.test.js index 3014e5820..5bd5d9eb9 100644 --- a/test/unescapeHTML/unescapeHTML.test.js +++ b/test/unescapeHTML/unescapeHTML.test.js @@ -5,6 +5,7 @@ test('Testing unescapeHTML', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof unescapeHTML === 'function', 'unescapeHTML is a Function'); + t.equal(unescapeHTML('<a href="#">Me & you</a>'), 'Me & you', 'Unescapes escaped HTML characters.'); //t.deepEqual(unescapeHTML(args..), 'Expected'); //t.equal(unescapeHTML(args..), 'Expected'); //t.false(unescapeHTML(args..), 'Expected'); diff --git a/test/validateNumber/validateNumber.test.js b/test/validateNumber/validateNumber.test.js index 921edec24..8a6d847ad 100644 --- a/test/validateNumber/validateNumber.test.js +++ b/test/validateNumber/validateNumber.test.js @@ -5,6 +5,7 @@ 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'); diff --git a/test/words/words.test.js b/test/words/words.test.js index c8deb7c41..f15d1446f 100644 --- a/test/words/words.test.js +++ b/test/words/words.test.js @@ -5,6 +5,9 @@ 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(args..), 'Expected'); //t.equal(words(args..), 'Expected'); //t.false(words(args..), 'Expected'); diff --git a/test/yesNo/yesNo.test.js b/test/yesNo/yesNo.test.js index 2d49b71a6..20922855a 100644 --- a/test/yesNo/yesNo.test.js +++ b/test/yesNo/yesNo.test.js @@ -5,6 +5,11 @@ 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.deepEqual(yesNo(args..), 'Expected'); //t.equal(yesNo(args..), 'Expected'); //t.false(yesNo(args..), 'Expected');