Co-authored-by: Colum Ferry <cferry09@gmail.com> Co-authored-by: Isaac Mann <isaacplmann@gmail.com>
27 lines
725 B
TypeScript
27 lines
725 B
TypeScript
import { selectSourceInfo } from './target-configuration-details.util';
|
|
|
|
test('selectSourceInfo', () => {
|
|
const map = {
|
|
targets: ['a', 'b'],
|
|
'targets.build': ['c', 'd'],
|
|
'targets.build.options.command': ['e', 'f'],
|
|
};
|
|
|
|
expect(selectSourceInfo(map, 'targets')).toEqual(['a', 'b']);
|
|
expect(selectSourceInfo(map, 'targets.build')).toEqual(['c', 'd']);
|
|
expect(selectSourceInfo(map, 'targets.build.options.command')).toEqual([
|
|
'e',
|
|
'f',
|
|
]);
|
|
// fallback to `targets.build`
|
|
expect(selectSourceInfo(map, 'targets.build.options.cwd')).toEqual([
|
|
'c',
|
|
'd',
|
|
]);
|
|
// fallback to `targets`
|
|
expect(selectSourceInfo(map, 'targets.echo.options.command')).toEqual([
|
|
'a',
|
|
'b',
|
|
]);
|
|
});
|