feature(util) add kebabToCamelCase

This commit is contained in:
coderaiser 2016-12-28 13:56:20 +02:00
parent 7036cb8ea2
commit f4332c779e
6 changed files with 43 additions and 15 deletions

View file

@ -12,7 +12,7 @@ var DIR = __dirname + '/../../',
test = require('tape'),
FS_DIR = TMPLDIR + 'fs/',
EXPECT_PATH = DIR + 'test/server/cloudfunc.html',
EXPECT_PATH = __dirname + '/cloudfunc.html',
TMPL_PATH = [
'file',

View file

@ -3,6 +3,10 @@
const test = require('tape');
const DIR = '../../';
const Util = require(DIR + 'common/util');
const {
getStrBigFirst,
kebabToCamelCase
} = Util;
test('getExt: no extension', (t) => {
const EXT = '';
@ -23,12 +27,22 @@ test('getExt: return extension', (t) => {
});
test('getStrBigFirst: args', (t) => {
t.throws(Util.getStrBigFirst, /str could not be empty!/, 'should throw when no str');
t.throws(getStrBigFirst, /str could not be empty!/, 'should throw when no str');
t.end();
});
test('getStrBigFirst', (t) => {
t.equal(Util.getStrBigFirst('hello'), 'Hello', 'should return str');
t.equal(getStrBigFirst('hello'), 'Hello', 'should return str');
t.end();
});
test('kebabToCamelCase: args', (t) => {
t.throws(kebabToCamelCase, /str could not be empty!/, 'should throw when no str');
t.end();
});
test('kebabToCamelCase', (t) => {
t.equal(kebabToCamelCase('hello-world'), 'HelloWorld', 'should convert kebab to camel caes');
t.end();
});