Files
payload/src/utilities/formatLabels.spec.ts
2020-11-20 15:23:32 -05:00

32 lines
743 B
TypeScript

import formatLabels from './formatLabels';
describe('formatLabels', () => {
it('should format single word', () => {
expect(formatLabels('word')).toMatchObject({
singular: 'Word',
plural: 'Words',
});
});
it('should format already plural', () => {
expect(formatLabels('words')).toMatchObject({
singular: 'Words',
plural: 'Words',
});
});
it('should format kebab case', () => {
expect(formatLabels('kebab-item')).toMatchObject({
singular: 'Kebab Item',
plural: 'Kebab Items',
});
});
it('should format camelCase', () => {
expect(formatLabels('camelCaseItem')).toMatchObject({
singular: 'Camel Case Item',
plural: 'Camel Case Items',
});
});
});