@@ -145,14 +145,24 @@ describe('parseJsonSchemaToOptions', () => {
145145 } ) ;
146146
147147 describe ( 'type=array, enum' , ( ) => {
148- it ( 'parses valid option value' , async ( ) => {
148+ it ( 'parses valid option value when specified once ' , async ( ) => {
149149 expect ( await parse ( [ '--arrayWithChoices' , 'always' , 'never' ] ) ) . toEqual (
150150 jasmine . objectContaining ( {
151151 'arrayWithChoices' : [ 'always' , 'never' ] ,
152152 } ) ,
153153 ) ;
154154 } ) ;
155155
156+ it ( 'parses valid option value when specified multiple times' , async ( ) => {
157+ expect (
158+ await parse ( [ '--arrayWithChoices' , 'always' , '--arrayWithChoices' , 'never' ] ) ,
159+ ) . toEqual (
160+ jasmine . objectContaining ( {
161+ 'arrayWithChoices' : [ 'always' , 'never' ] ,
162+ } ) ,
163+ ) ;
164+ } ) ;
165+
156166 it ( 'rejects non-enum values' , async ( ) => {
157167 await expectAsync ( parse ( [ '--arrayWithChoices' , 'yes' ] ) ) . toBeRejectedWithError (
158168 / A r g u m e n t : a r r a y - w i t h - c h o i c e s , G i v e n : " y e s " , C h o i c e s : / ,
@@ -165,14 +175,29 @@ describe('parseJsonSchemaToOptions', () => {
165175 } ) ;
166176
167177 describe ( 'type=array, enum in oneOf' , ( ) => {
168- it ( 'parses valid option value' , async ( ) => {
178+ it ( 'parses valid option value when specified once ' , async ( ) => {
169179 expect ( await parse ( [ '--arrayWithChoicesInOneOf' , 'default' , 'verbose' ] ) ) . toEqual (
170180 jasmine . objectContaining ( {
171181 'arrayWithChoicesInOneOf' : [ 'default' , 'verbose' ] ,
172182 } ) ,
173183 ) ;
174184 } ) ;
175185
186+ it ( 'parses valid option value when specified multiple times' , async ( ) => {
187+ expect (
188+ await parse ( [
189+ '--arrayWithChoicesInOneOf' ,
190+ 'default' ,
191+ '--arrayWithChoicesInOneOf' ,
192+ 'verbose' ,
193+ ] ) ,
194+ ) . toEqual (
195+ jasmine . objectContaining ( {
196+ 'arrayWithChoicesInOneOf' : [ 'default' , 'verbose' ] ,
197+ } ) ,
198+ ) ;
199+ } ) ;
200+
176201 it ( 'rejects non-enum values' , async ( ) => {
177202 await expectAsync ( parse ( [ '--arrayWithChoicesInOneOf' , 'yes' ] ) ) . toBeRejectedWithError (
178203 / A r g u m e n t : a r r a y - w i t h - c h o i c e s - i n - o n e - o f , G i v e n : " y e s " , C h o i c e s : / ,
@@ -181,13 +206,28 @@ describe('parseJsonSchemaToOptions', () => {
181206 } ) ;
182207
183208 describe ( 'type=array, anyOf' , ( ) => {
184- it ( 'parses valid option value' , async ( ) => {
209+ it ( 'parses valid option value when specified once ' , async ( ) => {
185210 expect ( await parse ( [ '--arrayWithComplexAnyOf' , 'default' , 'something-else' ] ) ) . toEqual (
186211 jasmine . objectContaining ( {
187212 'arrayWithComplexAnyOf' : [ 'default' , 'something-else' ] ,
188213 } ) ,
189214 ) ;
190215 } ) ;
216+
217+ it ( 'parses valid option value when specified multiple times' , async ( ) => {
218+ expect (
219+ await parse ( [
220+ '--arrayWithComplexAnyOf' ,
221+ 'default' ,
222+ '--arrayWithComplexAnyOf' ,
223+ 'something-else' ,
224+ ] ) ,
225+ ) . toEqual (
226+ jasmine . objectContaining ( {
227+ 'arrayWithComplexAnyOf' : [ 'default' , 'something-else' ] ,
228+ } ) ,
229+ ) ;
230+ } ) ;
191231 } ) ;
192232
193233 describe ( 'type=string, enum' , ( ) => {
0 commit comments