File tree 2 files changed +12
-3
lines changed
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -7,8 +7,10 @@ import { isBoolean } from '../utils';
7
7
* @returns {boolean }
8
8
*/
9
9
export default function camelCase ( value /* , currentConfig */ ) {
10
- if ( ! isBoolean ( value ) ) {
11
- throw new Error ( `Configuration 'camelCase' is not a boolean` ) ;
10
+ if ( ! isBoolean ( value ) && [ 'dashes' , 'dashesOnly' , 'only' ] . indexOf ( value ) < 0 ) {
11
+ throw new Error (
12
+ `Configuration 'camelCase' is not a boolean or one of 'dashes'|'dashesOnly'|'only'`
13
+ ) ;
12
14
}
13
15
14
16
return value ;
Original file line number Diff line number Diff line change @@ -3,11 +3,18 @@ import { expect } from 'chai';
3
3
import camelCase from '../../src/options_resolvers/camelCase' ;
4
4
5
5
describe ( 'options_resolvers/camelCase' , ( ) => {
6
- it ( 'should throw if camelCase value is not a boolean' , ( ) => {
6
+ it ( 'should throw if camelCase value is not a boolean or is not in enum ' , ( ) => {
7
7
expect (
8
8
( ) => camelCase ( null )
9
9
) . to . throw ( ) ;
10
10
11
+ expect (
12
+ ( ) => camelCase ( 'unknown' )
13
+ ) . to . throw ( ) ;
14
+
11
15
expect ( camelCase ( true ) ) . to . be . equal ( true ) ;
16
+ expect ( camelCase ( 'dashes' ) ) . to . be . equal ( 'dashes' ) ;
17
+ expect ( camelCase ( 'dashesOnly' ) ) . to . be . equal ( 'dashesOnly' ) ;
18
+ expect ( camelCase ( 'only' ) ) . to . be . equal ( 'only' ) ;
12
19
} ) ;
13
20
} ) ;
You can’t perform that action at this time.
0 commit comments