Files
klz-cables.com/.pnpm-store/v10/files/07/4a7c81c6db27c4ff6c9e2636cf1045c3289b0e45a398fca698edcaf02f0125ddef4e234adab9389a9cbca91be21816c74d4f15d370d4f70131ed6aacd5b4c3
Marc Mintel 5397309103
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
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

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