File size: 732 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
import { camelToSnakeCase } from '../camelToSnakeCase';

describe('camelToSnakeCase', () => {
  it('should convert camelCase to snake_case', () => {
    expect(camelToSnakeCase('cloudUserWorkspaces')).toBe(
      'cloud_user_workspaces',
    );
  });

  it('should convert single-word camelCase', () => {
    expect(camelToSnakeCase('people')).toBe('people');
  });

  it('should handle two-word camelCase', () => {
    expect(camelToSnakeCase('selfHostingUser')).toBe('self_hosting_user');
  });

  it('should handle already snake_case', () => {
    expect(camelToSnakeCase('already_snake')).toBe('already_snake');
  });

  it('should handle single word', () => {
    expect(camelToSnakeCase('company')).toBe('company');
  });
});