apphouse
Version:
Component library for React that uses observable state management and theme-able components.
23 lines (20 loc) • 793 B
text/typescript
import { makeTitle } from './makeTitle';
describe('makeTitle', () => {
it('converts a camelCase string to title case but dont capitalize all', () => {
expect(makeTitle('camelCaseString')).toEqual('Camel case string');
expect(makeTitle('thisIsAnotherExample')).toEqual(
'This is another example'
);
expect(makeTitle('test')).toEqual('Test');
});
it('converts a camelCase string to title case and capitalize all', () => {
expect(makeTitle('camelCaseString', true)).toEqual('Camel Case String');
expect(makeTitle('thisIsAnotherExample', true)).toEqual(
'This Is Another Example'
);
expect(makeTitle('test')).toEqual('Test');
});
it('returns an empty string when the input is empty', () => {
expect(makeTitle('')).toEqual('');
});
});