@@ -103,7 +103,7 @@ def fn():
103
103
expect ( extractStringEnum ( 'wassup' ) ) . toBe ( null ) ;
104
104
} ) ;
105
105
106
- describe ( 'with single quotes ' , ( ) => {
106
+ describe ( 'with backticks ' , ( ) => {
107
107
it ( 'should extract an enum of the format "can be x"' , ( ) => {
108
108
const values = extractStringEnum ( 'Can be `x`' ) ! ;
109
109
expect ( values ) . not . toBe ( null ) ;
@@ -160,9 +160,18 @@ def fn():
160
160
expect ( values [ 1 ] . value ) . toBe ( 'b' ) ;
161
161
expect ( values [ 2 ] . value ) . toBe ( 'c' ) ;
162
162
} ) ;
163
+
164
+ it . only ( 'should extract an enum with underscores in the values' , ( ) => {
165
+ const values = extractStringEnum ( 'Values includes `a`, `b_c` and `d`' ) ! ;
166
+ expect ( values ) . not . toBe ( null ) ;
167
+ expect ( values ) . toHaveLength ( 3 ) ;
168
+ expect ( values [ 0 ] . value ) . toBe ( 'a' ) ;
169
+ expect ( values [ 1 ] . value ) . toBe ( 'b_c' ) ;
170
+ expect ( values [ 2 ] . value ) . toBe ( 'd' ) ;
171
+ } ) ;
163
172
} ) ;
164
173
165
- describe ( 'with backticks ' , ( ) => {
174
+ describe ( 'with single quotes ' , ( ) => {
166
175
it ( 'should extract an enum of the format "can be x"' , ( ) => {
167
176
const values = extractStringEnum ( `Can be 'x'` ) ! ;
168
177
expect ( values ) . not . toBe ( null ) ;
0 commit comments