@@ -170,6 +170,34 @@ def fn():
170
170
expect ( values [ 1 ] . value ) . toBe ( 'b_c' ) ;
171
171
expect ( values [ 2 ] . value ) . toBe ( 'd' ) ;
172
172
} ) ;
173
+
174
+ it ( 'should extract an enum with fullstops in the values' , ( ) => {
175
+ const values = extractStringEnum ( 'Values includes `a`, `b.c` and `d`' ) ! ;
176
+ expect ( values ) . not . toBe ( null ) ;
177
+ expect ( values ) . toHaveLength ( 3 ) ;
178
+ expect ( values [ 0 ] . value ) . toBe ( 'a' ) ;
179
+ expect ( values [ 1 ] . value ) . toBe ( 'b.c' ) ;
180
+ expect ( values [ 2 ] . value ) . toBe ( 'd' ) ;
181
+ } ) ;
182
+
183
+ it ( 'should extract an enum with colons in the values' , ( ) => {
184
+ const values = extractStringEnum ( 'Values includes `a`, `https:` and `d`' ) ! ;
185
+ expect ( values ) . not . toBe ( null ) ;
186
+ expect ( values ) . toHaveLength ( 3 ) ;
187
+ expect ( values [ 0 ] . value ) . toBe ( 'a' ) ;
188
+ expect ( values [ 1 ] . value ) . toBe ( 'https:' ) ;
189
+ expect ( values [ 2 ] . value ) . toBe ( 'd' ) ;
190
+ } ) ;
191
+
192
+ it ( 'should extract an enum with numbers in the values' , ( ) => {
193
+ const values = extractStringEnum ( 'Can be `tls1`, `tls1.1`, `tls1.2` or `tls1.3`.' ) ! ;
194
+ expect ( values ) . not . toBe ( null ) ;
195
+ expect ( values ) . toHaveLength ( 4 ) ;
196
+ expect ( values [ 0 ] . value ) . toBe ( 'tls1' ) ;
197
+ expect ( values [ 1 ] . value ) . toBe ( 'tls1.1' ) ;
198
+ expect ( values [ 2 ] . value ) . toBe ( 'tls1.2' ) ;
199
+ expect ( values [ 3 ] . value ) . toBe ( 'tls1.3' ) ;
200
+ } ) ;
173
201
} ) ;
174
202
175
203
describe ( 'with single quotes' , ( ) => {
0 commit comments