mirror of https://github.com/keeweb/keeweb.git
string format test
This commit is contained in:
parent
a1a02d5098
commit
5cac16a632
|
@ -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');
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue