Skip to content

Commit 699fc70

Browse files
committed
test: simplify array option parsing test cases by consolidating multiple flag usages into a single flag with multiple values
This ensures that array parsing is handled correctly. (cherry picked from commit 9c2ca3a)
1 parent 465073b commit 699fc70

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

packages/angular/cli/src/command-builder/utilities/json-schema_spec.ts

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,7 @@ describe('parseJsonSchemaToOptions', () => {
139139

140140
describe('type=array, enum', () => {
141141
it('parses valid option value', async () => {
142-
expect(
143-
await parse(['--arrayWithChoices', 'always', '--arrayWithChoices', 'never']),
144-
).toEqual(
142+
expect(await parse(['--arrayWithChoices', 'always', 'never'])).toEqual(
145143
jasmine.objectContaining({
146144
'arrayWithChoices': ['always', 'never'],
147145
}),
@@ -161,14 +159,7 @@ describe('parseJsonSchemaToOptions', () => {
161159

162160
describe('type=array, enum in oneOf', () => {
163161
it('parses valid option value', async () => {
164-
expect(
165-
await parse([
166-
'--arrayWithChoicesInOneOf',
167-
'default',
168-
'--arrayWithChoicesInOneOf',
169-
'verbose',
170-
]),
171-
).toEqual(
162+
expect(await parse(['--arrayWithChoicesInOneOf', 'default', 'verbose'])).toEqual(
172163
jasmine.objectContaining({
173164
'arrayWithChoicesInOneOf': ['default', 'verbose'],
174165
}),
@@ -184,14 +175,7 @@ describe('parseJsonSchemaToOptions', () => {
184175

185176
describe('type=array, anyOf', () => {
186177
it('parses valid option value', async () => {
187-
expect(
188-
await parse([
189-
'--arrayWithComplexAnyOf',
190-
'default',
191-
'--arrayWithComplexAnyOf',
192-
'something-else',
193-
]),
194-
).toEqual(
178+
expect(await parse(['--arrayWithComplexAnyOf', 'default', 'something-else'])).toEqual(
195179
jasmine.objectContaining({
196180
'arrayWithComplexAnyOf': ['default', 'something-else'],
197181
}),

0 commit comments

Comments
 (0)