File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 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';
77 * @returns {boolean }
88 */
99export 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+ ) ;
1214 }
1315
1416 return value ;
Original file line number Diff line number Diff line change @@ -3,11 +3,18 @@ import { expect } from 'chai';
33import camelCase from '../../src/options_resolvers/camelCase' ;
44
55describe ( '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 ' , ( ) => {
77 expect (
88 ( ) => camelCase ( null )
99 ) . to . throw ( ) ;
1010
11+ expect (
12+ ( ) => camelCase ( 'unknown' )
13+ ) . to . throw ( ) ;
14+
1115 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' ) ;
1219 } ) ;
1320} ) ;
You can’t perform that action at this time.
0 commit comments