Ensures no missingResourceIcon for WFJT on JTList

Adds a test to ensure that missingResourceIcon is not shown for WFJTs.
This commit is contained in:
Alex Corey 2020-01-23 10:53:41 -05:00
parent 0a8fe4d812
commit 21890efca6
2 changed files with 24 additions and 3 deletions

View File

@ -63,9 +63,11 @@ class TemplateListItem extends Component {
const { i18n, template, isSelected, onSelect } = this.props;
const canLaunch = template.summary_fields.user_capabilities.start;
const missingResourceIcon =
(!template.summary_fields.inventory &&
!template.ask_inventory_on_launch) ||
!template.summary_fields.project;
template.type === 'job_template' &&
(!template.summary_fields.project ||
(!template.summary_fields.inventory &&
!template.ask_inventory_on_launch));
return (
<DataListItem
aria-labelledby={`check-action-${template.id}`}

View File

@ -142,4 +142,23 @@ describe('<TemplatesListItem />', () => {
);
expect(wrapper.find('ExclamationTriangleIcon').exists()).toBe(false);
});
test('missing resource icon is not shown type is workflow_job_template', () => {
const wrapper = mountWithContexts(
<TemplatesListItem
isSelected={false}
template={{
id: 1,
name: 'Template 1',
url: '/templates/job_template/1',
type: 'workflow_job_template',
summary_fields: {
user_capabilities: {
edit: false,
},
},
}}
/>
);
expect(wrapper.find('ExclamationTriangleIcon').exists()).toBe(false);
});
});