Files
30-seconds-of-code/test6/toCamelCase/toCamelCase.test.js
Angelos Chalaris 5afe81452a Migrated tests to jest
Used jest-codemods to migrate, will have to pass everything by hand before we can merge.
2018-06-18 14:18:25 +03:00

22 lines
1.0 KiB
JavaScript

const expect = require('expect');
const toCamelCase = require('./toCamelCase.js');
test('Testing toCamelCase', () => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
expect(typeof toCamelCase === 'function').toBeTruthy();
expect(toCamelCase('some_database_field_name')).toBe('someDatabaseFieldName');
expect(toCamelCase('Some label that needs to be camelized')).toBe('someLabelThatNeedsToBeCamelized');
expect(toCamelCase('some-javascript-property')).toBe('someJavascriptProperty');
expect(toCamelCase('some-mixed_string with spaces_underscores-and-hyphens')).toBe('someMixedStringWithSpacesUnderscoresAndHyphens');
expect(() => toCamelCase()).toThrow();
expect(() => toCamelCase([])).toThrow();
expect(() => toCamelCase({})).toThrow();
expect(() => toCamelCase(123)).toThrow();
let start = new Date().getTime();
toCamelCase('some-mixed_string with spaces_underscores-and-hyphens');
let end = new Date().getTime();
expect((end - start) < 2000).toBeTruthy();
});