Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(devkit): parseTargetString should support targets with colons in …
…the name (#10400)
- Loading branch information
1 parent
99b4c60
commit e439718
Showing
4 changed files
with
41 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { parseTargetString, targetToTargetString } from './parse-target-string'; | ||
|
||
const cases = [ | ||
{ input: 'one:two', expected: { project: 'one', target: 'two' } }, | ||
{ | ||
input: 'one:two:three', | ||
expected: { project: 'one', target: 'two', configuration: 'three' }, | ||
}, | ||
{ | ||
input: 'one:"two:two":three', | ||
expected: { project: 'one', target: 'two:two', configuration: 'three' }, | ||
}, | ||
]; | ||
|
||
describe('parseTargetString', () => { | ||
it.each(cases)('$input -> $expected', ({ input, expected }) => { | ||
expect(parseTargetString(input)).toEqual(expected); | ||
}); | ||
}); | ||
|
||
describe('targetToTargetString', () => { | ||
it.each(cases)('$expected -> $input', ({ input, expected }) => { | ||
expect(targetToTargetString(expected)).toEqual(input); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import { splitTarget } from './split-target'; | ||
|
||
const cases = [ | ||
{ input: 'one', expected: ['one'] }, | ||
{ input: 'one:two', expected: ['one', 'two'] }, | ||
{ input: 'one:two:three', expected: ['one', 'two', 'three'] }, | ||
{ input: 'one:"two:two":three', expected: ['one', 'two:two', 'three'] }, | ||
]; | ||
|
||
describe('splitTarget', () => { | ||
it('should work', () => { | ||
expect(splitTarget('one')).toEqual(['one']); | ||
expect(splitTarget('one:two')).toEqual(['one', 'two']); | ||
expect(splitTarget('one:two:three')).toEqual(['one', 'two', 'three']); | ||
expect(splitTarget('one:"two:two":three')).toEqual([ | ||
'one', | ||
'two:two', | ||
'three', | ||
]); | ||
it.each(cases)('$input -> $expected', ({ input, expected }) => { | ||
expect(splitTarget(input)).toEqual(expected); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters