feature/default_network_editable
parent
b2939e8627
commit
50d91f998d
@ -0,0 +1,5 @@ |
||||
export function camelCaseToCapitalize (str) { |
||||
return str |
||||
.replace(/([A-Z])/g, ' $1') |
||||
.replace(/^./, str => str.toUpperCase()) |
||||
} |
@ -0,0 +1,23 @@ |
||||
import * as utils from '../common.util' |
||||
import assert from 'assert' |
||||
|
||||
describe('Common utils', () => { |
||||
describe('camelCaseToCapitalize', () => { |
||||
it('should return a capitalized string from a camel-cased string', () => { |
||||
const tests = [ |
||||
{ |
||||
test: '', |
||||
expected: '', |
||||
}, |
||||
{ |
||||
test: 'thisIsATest', |
||||
expected: 'This Is A Test', |
||||
}, |
||||
] |
||||
|
||||
tests.forEach(({ test, expected }) => { |
||||
assert.equal(utils.camelCaseToCapitalize(test), expected) |
||||
}) |
||||
}) |
||||
}) |
||||
}) |
Loading…
Reference in new issue