1
+ import { kebabToCamelCase } from './string_utils' ;
2
+
3
+ describe ( 'kebabToCamelCase' , ( ) => {
4
+ it ( 'should convert kebab-case to camelCase' , ( ) => {
5
+ const cache = new Map < string , string > ( ) ;
6
+ expect ( kebabToCamelCase ( 'hello-world' , cache ) ) . toBe ( 'helloWorld' ) ;
7
+ expect ( kebabToCamelCase ( 'foo-bar-baz' , cache ) ) . toBe ( 'fooBarBaz' ) ;
8
+ expect ( kebabToCamelCase ( 'single' , cache ) ) . toBe ( 'single' ) ;
9
+ } ) ;
10
+
11
+ it ( 'should use cache for repeated conversions' , ( ) => {
12
+ const cache = new Map < string , string > ( ) ;
13
+ const result1 = kebabToCamelCase ( 'test-string' , cache ) ;
14
+ const result2 = kebabToCamelCase ( 'test-string' , cache ) ;
15
+
16
+ expect ( result1 ) . toBe ( 'testString' ) ;
17
+ expect ( result2 ) . toBe ( 'testString' ) ;
18
+ expect ( cache . get ( 'test-string' ) ) . toBe ( 'testString' ) ;
19
+ } ) ;
20
+
21
+ it ( 'should handle empty string' , ( ) => {
22
+ const cache = new Map < string , string > ( ) ;
23
+ expect ( kebabToCamelCase ( '' , cache ) ) . toBe ( '' ) ;
24
+ } ) ;
25
+
26
+ it ( 'should handle string with no hyphens' , ( ) => {
27
+ const cache = new Map < string , string > ( ) ;
28
+ expect ( kebabToCamelCase ( 'alreadycamelcase' , cache ) ) . toBe ( 'alreadycamelcase' ) ;
29
+ } ) ;
30
+ } ) ;
0 commit comments