File size: 796 Bytes
d9494a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { pascalToKebab } from '../pascalToKebab';

describe('pascalToKebab', () => {
  it('should convert PascalCase to kebab-case', () => {
    expect(pascalToKebab('UserProfile')).toBe('user-profile');
  });

  it('should convert single word', () => {
    expect(pascalToKebab('Button')).toBe('button');
  });

  it('should handle consecutive uppercase letters', () => {
    expect(pascalToKebab('HTMLElement')).toBe('html-element');
  });

  it('should handle numbers in the name', () => {
    expect(pascalToKebab('H1Title')).toBe('h1-title');
  });

  it('should handle multi-word PascalCase', () => {
    expect(pascalToKebab('MyComponentName')).toBe('my-component-name');
  });

  it('should handle already lowercase', () => {
    expect(pascalToKebab('button')).toBe('button');
  });
});