Test files linted

This commit is contained in:
Angelos Chalaris
2018-08-03 10:39:26 +03:00
parent 5ef1fab5fd
commit cc7b76d0b3
153 changed files with 754 additions and 463 deletions

View File

@ -4,33 +4,45 @@ const toKebabCase = require('./toKebabCase.js');
test('toKebabCase is a Function', () => {
expect(toKebabCase).toBeInstanceOf(Function);
});
test('toKebabCase(\'camelCase\') returns camel-case', () => {
test("toKebabCase('camelCase') returns camel-case", () => {
expect(toKebabCase('camelCase')).toBe('camel-case');
});
test('toKebabCase(\'some text\') returns some-text', () => {
test("toKebabCase('some text') returns some-text", () => {
expect(toKebabCase('some text')).toBe('some-text');
});
test('toKebabCase(\'some-mixed-string With spaces-underscores-and-hyphens\') returns some-mixed-string-with-spaces-underscores-and-hyphens', () => {
expect(toKebabCase('some-mixed-string With spaces-underscores-and-hyphens')).toBe('some-mixed-string-with-spaces-underscores-and-hyphens');
test("toKebabCase('some-mixed-string With spaces-underscores-and-hyphens') returns some-mixed-string-with-spaces-underscores-and-hyphens", () => {
expect(toKebabCase('some-mixed-string With spaces-underscores-and-hyphens')).toBe(
'some-mixed-string-with-spaces-underscores-and-hyphens'
);
});
test('toKebabCase(\'IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML\') returns i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html', () => {
expect(toKebabCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML')).toBe('i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html');
test("toKebabCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML') returns i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html", () => {
expect(
toKebabCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML')
).toBe(
'i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html'
);
});
test('toKebabCase() returns undefined', () => {
expect(toKebabCase()).toBe(undefined);
});
test('toKebabCase([]) throws an erro', () => {
expect(() => { toKebabCase([]); }).toThrow();
expect(() => {
toKebabCase([]);
}).toThrow();
});
test('toKebabCase({}) throws an erro', () => {
expect(() => { toKebabCase({}); }).toThrow();
expect(() => {
toKebabCase({});
}).toThrow();
});
test('toKebabCase(123) throws an erro', () => {
expect(() => { toKebabCase(123); }).toThrow();
expect(() => {
toKebabCase(123);
}).toThrow();
});
let start = new Date().getTime();
toKebabCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML');
let end = new Date().getTime();
test('toKebabCase(IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML) takes less than 2s to run', () => {
expect((end - start) < 2000).toBeTruthy();
expect(end - start < 2000).toBeTruthy();
});