@@ -32,3 +32,61 @@ it('should validate valid JavaScript-like identifiers allowing internal hyphens'
32
32
expect ( isValidIdentifierCamelized ( '-invalid-identifier' ) ) . toBe ( false ) ;
33
33
expect ( isValidIdentifierCamelized ( 'invalid-identifier-' ) ) . toBe ( true ) ;
34
34
} ) ;
35
+
36
+ describe ( 'toPascalCase' , ( ) => {
37
+ test ( 'converts normal string' , ( ) => {
38
+ expect ( toPascalCase ( 'hello_world' ) ) . toBe ( 'HelloWorld' ) ;
39
+ } ) ;
40
+
41
+ test ( 'converts string with multiple underscores and mixed case' , ( ) => {
42
+ expect ( toPascalCase ( 'Object_ID' ) ) . toBe ( 'ObjectID' ) ;
43
+ expect ( toPascalCase ( 'Postgre_SQL_View' ) ) . toBe ( 'PostgreSQLView' ) ;
44
+ expect ( toPascalCase ( 'postgre_sql_view' ) ) . toBe ( 'PostgreSqlView' ) ;
45
+ } ) ;
46
+
47
+ test ( 'handles string with multiple separators together' , ( ) => {
48
+ expect ( toPascalCase ( 'hello___world--great' ) ) . toBe ( 'HelloWorldGreat' ) ;
49
+ } ) ;
50
+
51
+ test ( 'handles single word' , ( ) => {
52
+ expect ( toPascalCase ( 'word' ) ) . toBe ( 'Word' ) ;
53
+ } ) ;
54
+
55
+ test ( 'handles empty string' , ( ) => {
56
+ expect ( toPascalCase ( '' ) ) . toBe ( '' ) ;
57
+ } ) ;
58
+
59
+ test ( 'handles string with numbers' , ( ) => {
60
+ expect ( toPascalCase ( 'version1_2_3' ) ) . toBe ( 'Version123' ) ;
61
+ } ) ;
62
+ } ) ;
63
+
64
+ describe ( 'toCamelCase' , ( ) => {
65
+ test ( 'converts hyphenated string' , ( ) => {
66
+ expect ( toCamelCase ( 'hello-world' ) ) . toBe ( 'helloWorld' ) ;
67
+ } ) ;
68
+
69
+ test ( 'converts underscored string' , ( ) => {
70
+ expect ( toCamelCase ( 'hello_world' ) ) . toBe ( 'helloWorld' ) ;
71
+ } ) ;
72
+
73
+ test ( 'converts spaces' , ( ) => {
74
+ expect ( toCamelCase ( 'hello world' ) ) . toBe ( 'helloWorld' ) ;
75
+ } ) ;
76
+
77
+ test ( 'handles mixed separators' , ( ) => {
78
+ expect ( toCamelCase ( 'hello-world_now what' ) ) . toBe ( 'helloWorldNowWhat' ) ;
79
+ } ) ;
80
+
81
+ test ( 'handles empty string' , ( ) => {
82
+ expect ( toCamelCase ( '' ) ) . toBe ( '' ) ;
83
+ } ) ;
84
+
85
+ test ( 'handles string starting with separators' , ( ) => {
86
+ expect ( toCamelCase ( '-hello_world' ) ) . toBe ( 'helloWorld' ) ;
87
+ } ) ;
88
+
89
+ test ( 'handles string with multiple separators together' , ( ) => {
90
+ expect ( toCamelCase ( 'hello___world--great' ) ) . toBe ( 'helloWorldGreat' ) ;
91
+ } ) ;
92
+ } ) ;
0 commit comments