Spaces:
Build error
Build error
File size: 1,167 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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | import { pascalCase } from '@/utils/strings/pascalCase';
describe('pascalCase', () => {
it('converts a string to pascal case', () => {
// Given
const input = 'HELLO_WORLD';
// When
const result = pascalCase(input);
// Then
expect(result).toBe('HelloWorld');
});
it('handles empty strings', () => {
// Given
const input = '';
// When
const result = pascalCase(input);
// Then
expect(result).toBe('');
});
it('handles strings with only one word', () => {
// Given
const input = 'hello';
// When
const result = pascalCase(input);
// Then
expect(result).toBe('Hello');
});
it('handles strings with several words, spaces and special characters', () => {
// Given
const input = '& Hello world! How are you today? #';
// When
const result = pascalCase(input);
// Then
expect(result).toBe('HelloWorldHowAreYouToday');
});
it('handles strings with leading and trailing spaces', () => {
// Given
const input = ' hello_world ';
// When
const result = pascalCase(input);
// Then
expect(result).toBe('HelloWorld');
});
});
|