From c77ec48ab40a41d7b9c2e76f63d2aa099a90e30b Mon Sep 17 00:00:00 2001 From: King Date: Fri, 26 Jan 2018 17:04:49 -0500 Subject: [PATCH] update toKebabCase.test.js omit, type, timed, error test --- test/toKebabCase/toKebabCase.test.js | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/test/toKebabCase/toKebabCase.test.js b/test/toKebabCase/toKebabCase.test.js index fe305e2b2..caa4c25ea 100644 --- a/test/toKebabCase/toKebabCase.test.js +++ b/test/toKebabCase/toKebabCase.test.js @@ -5,13 +5,18 @@ test('Testing toKebabCase', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof toKebabCase === 'function', 'toKebabCase is a Function'); - t.equal(toKebabCase('camelCase'), 'camel-case', "string converts to snake case"); - t.equal(toKebabCase('some text'), 'some-text', "string converts to snake case"); - t.equal(toKebabCase('some-mixed-string With spaces-underscores-and-hyphens'), 'some-mixed-string-with-spaces-underscores-and-hyphens', "string converts to snake case"); - t.equal(toKebabCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML'), 'i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html', "string converts to snake case"); - //t.deepEqual(toKebabCase(args..), 'Expected'); - //t.equal(toKebabCase(args..), 'Expected'); - //t.false(toKebabCase(args..), 'Expected'); - //t.throws(toKebabCase(args..), 'Expected'); + t.equal(toKebabCase('camelCase'), 'camel-case', "toKebabCase('camelCase') returns camel-case"); + t.equal(toKebabCase('some text'), 'some-text', "toKebabCase('some text') returns some-text"); + t.equal(toKebabCase('some-mixed-string With spaces-underscores-and-hyphens'), 'some-mixed-string-with-spaces-underscores-and-hyphens', "toKebabCase('some-mixed-string With spaces-underscores-and-hyphens') returns some-mixed-string-with-spaces-underscores-and-hyphens"); + t.equal(toKebabCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML'), 'i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html', "toKebabCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML') returns i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html"); + t.equal(toKebabCase(), undefined, 'toKebabCase() return undefined'); + t.throws(() => toKebabCase([]), 'Expected'); + t.throws(() => toKebabCase({}), 'Expected'); + t.throws(() => toKebabCase(123), 'Expected'); + + let start = new Date().getTime(); + toKebabCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML') + let end = new Date().getTime(); + t.true((end - start) < 2000, 'toKebabCase(IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML) takes less than 2s to run'); t.end(); -}); \ No newline at end of file +});