nx/graph/ui-project-details/src/lib/target-configuration-details/target-configuration-details.util.spec.ts
Jack Hsu 7b680ec68c
feat(docs): add {% project-details %} as a tag in markdown docs (#21288)
Co-authored-by: Colum Ferry <cferry09@gmail.com>
Co-authored-by: Isaac Mann <isaacplmann@gmail.com>
2024-01-24 12:53:03 -05:00

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',
]);
});