From ea8e2c407781aee8e14118adedf6be6f0c8f3aaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Feje=C5=A1?= Date: Wed, 10 Jan 2018 11:24:21 +0100 Subject: [PATCH] add 2 tests, yesNo and unescapeHTML There is a bug with words.test (I've commented on it) --- test/unescapeHTML/unescapeHTML.test.js | 1 + test/words/words.test.js | 1 + test/yesNo/yesNo.test.js | 5 +++++ 3 files changed, 7 insertions(+) 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/words/words.test.js b/test/words/words.test.js index c8deb7c41..b64edd235 100644 --- a/test/words/words.test.js +++ b/test/words/words.test.js @@ -5,6 +5,7 @@ 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.equal(words('I love javaScript!!'), ["I", "love", "javaScript"], "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');