Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
38 lines
1.2 KiB
Plaintext
38 lines
1.2 KiB
Plaintext
import { describe, it, expect } from 'vitest';
|
|
import { formatLabels, toWords } from './formatLabels';
|
|
describe('formatLabels', ()=>{
|
|
it('should format singular slug', ()=>{
|
|
expect(formatLabels('word')).toMatchObject({
|
|
plural: 'Words',
|
|
singular: 'Word'
|
|
});
|
|
});
|
|
it('should format plural slug', ()=>{
|
|
expect(formatLabels('words')).toMatchObject({
|
|
plural: 'Words',
|
|
singular: 'Word'
|
|
});
|
|
});
|
|
it('should format kebab case', ()=>{
|
|
expect(formatLabels('my-slugs')).toMatchObject({
|
|
plural: 'My Slugs',
|
|
singular: 'My Slug'
|
|
});
|
|
});
|
|
it('should format camelCase', ()=>{
|
|
expect(formatLabels('camelCaseItems')).toMatchObject({
|
|
plural: 'Camel Case Items',
|
|
singular: 'Camel Case Item'
|
|
});
|
|
});
|
|
describe('toWords', ()=>{
|
|
it('should convert camel to capitalized words', ()=>{
|
|
expect(toWords('camelCaseItems')).toBe('Camel Case Items');
|
|
});
|
|
it('should allow no separator (used for building GraphQL label from name)', ()=>{
|
|
expect(toWords('myGraphField', true)).toBe('MyGraphField');
|
|
});
|
|
});
|
|
});
|
|
|
|
//# sourceMappingURL=formatLabels.spec.js.map |