diff --git a/test/src/formatting/string-format.js b/test/src/formatting/string-format.js new file mode 100644 index 00000000..d4e2cfe0 --- /dev/null +++ b/test/src/formatting/string-format.js @@ -0,0 +1,28 @@ +import { expect } from 'chai'; +import { StringFormat } from 'util/formatting/string-format'; + +describe('StringFormat', () => { + it('should capitalize first character', () => { + expect(StringFormat.capFirst('xYz')).to.eql('XYz'); + }); + + it('should add number padding when required', () => { + expect(StringFormat.pad(123, 5)).to.eql('00123'); + }); + + it('should not add number padding when not required', () => { + expect(StringFormat.pad(123, 3)).to.eql('123'); + }); + + it('should add string padding when required', () => { + expect(StringFormat.padStr('abc', 5)).to.eql('abc '); + }); + + it('should not add string padding when not required', () => { + expect(StringFormat.padStr('abc', 3)).to.eql('abc'); + }); + + it('should convert kebab case to camel case', () => { + expect(StringFormat.camelCase('aa-bbb-c')).to.eql('aaBbbC'); + }); +});