update toCamelCase omit, type, time test, error

This commit is contained in:
King
2018-01-26 16:56:37 -05:00
parent 83e6996238
commit 62aae1c41f

View File

@ -5,13 +5,18 @@ test('Testing toCamelCase', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof toCamelCase === 'function', 'toCamelCase is a Function');
t.equal(toCamelCase('some_database_field_name'), 'someDatabaseFieldName', "Converts a string to camelCase");
t.equal(toCamelCase('Some label that needs to be camelized'), 'someLabelThatNeedsToBeCamelized', "Converts a string to camelCase");
t.equal(toCamelCase('some-javascript-property'), 'someJavascriptProperty', "Converts a string to camelCase");
t.equal(toCamelCase('some-mixed_string with spaces_underscores-and-hyphens'), 'someMixedStringWithSpacesUnderscoresAndHyphens', "Converts a string to camelCase");
//t.deepEqual(toCamelCase(args..), 'Expected');
//t.equal(toCamelCase(args..), 'Expected');
//t.false(toCamelCase(args..), 'Expected');
//t.throws(toCamelCase(args..), 'Expected');
t.equal(toCamelCase('some_database_field_name'), 'someDatabaseFieldName', "toCamelCase('some_database_field_name') returns someDatabaseFieldName");
t.equal(toCamelCase('Some label that needs to be camelized'), 'someLabelThatNeedsToBeCamelized', "toCamelCase('Some label that needs to be camelized') returns someLabelThatNeedsToBeCamelized");
t.equal(toCamelCase('some-javascript-property'), 'someJavascriptProperty', "toCamelCase('some-javascript-property') return someJavascriptProperty");
t.equal(toCamelCase('some-mixed_string with spaces_underscores-and-hyphens'), 'someMixedStringWithSpacesUnderscoresAndHyphens', "toCamelCase('some-mixed_string with spaces_underscores-and-hyphens') returns someMixedStringWithSpacesUnderscoresAndHyphens");
t.throws(() => toCamelCase(), 'toCamelCase() throws a error');
t.throws(() => toCamelCase([]), 'toCamelCase([]) throws a error');
t.throws(() => toCamelCase({}), 'toCamelCase({}) throws a error');
t.throws(() => toCamelCase(123), 'toCamelCase(123) throws a error');
let start = new Date().getTime();
toCamelCase('some-mixed_string with spaces_underscores-and-hyphens');
let end = new Date().getTime();
t.true((end - start) < 2000, 'toCamelCase(some-mixed_string with spaces_underscores-and-hyphens) takes less than 2s to run');
t.end();
});
});