fix Schedule tests

This commit is contained in:
Keith J. Grant 2021-04-12 09:42:36 -07:00
parent 445b2fef84
commit 79118cfbe2
3 changed files with 35 additions and 27 deletions

View File

@ -42,12 +42,12 @@ describe('<VariablesDetail>', () => {
expect(input2.prop('value')).toEqual('foo: bar\n');
});
test('should render label and value= --- when there are no values', () => {
test('should render label and value --- when there are no values', () => {
const wrapper = mountWithContexts(
<VariablesDetail value="" label="Variables" />
);
expect(wrapper.find('VariablesDetail___StyledCodeEditor').length).toBe(1);
expect(wrapper.find('div.pf-c-form__label').text()).toBe('Variables');
expect(wrapper.find('.pf-c-form__label').text()).toBe('Variables');
});
test('should update value if prop changes', () => {

View File

@ -121,8 +121,8 @@ describe('<Schedule />', () => {
});
test('expect all tabs to exist, including Back to Schedules', async () => {
expect(
wrapper.find('button[link="/templates/job_template/1/schedules"]').length
wrapper.find('a[href="/templates/job_template/1/schedules"]').length
).toBe(1);
expect(wrapper.find('button[aria-label="Details"]').length).toBe(1);
expect(wrapper.find('a[aria-label="Details"]').length).toBe(1);
});
});

View File

@ -50,13 +50,17 @@ describe('ScheduleListItem', () => {
describe('User has edit permissions', () => {
beforeAll(() => {
wrapper = mountWithContexts(
<ScheduleListItem
isSelected={false}
onSelect={onSelect}
schedule={mockSchedule}
isMissingSurvey={false}
isMissingInventory={false}
/>
<table>
<tbody>
<ScheduleListItem
isSelected={false}
onSelect={onSelect}
schedule={mockSchedule}
isMissingSurvey={false}
isMissingInventory={false}
/>
</tbody>
</table>
);
});
@ -190,22 +194,26 @@ describe('ScheduleListItem', () => {
describe('schedule has missing prompt data', () => {
beforeAll(() => {
wrapper = mountWithContexts(
<ScheduleListItem
isSelected={false}
onSelect={onSelect}
schedule={{
...mockSchedule,
summary_fields: {
...mockSchedule.summary_fields,
user_capabilities: {
edit: false,
delete: false,
},
},
}}
isMissingInventory="Inventory Error"
isMissingSurvey="Survey Error"
/>
<table>
<tbody>
<ScheduleListItem
isSelected={false}
onSelect={onSelect}
schedule={{
...mockSchedule,
summary_fields: {
...mockSchedule.summary_fields,
user_capabilities: {
edit: false,
delete: false,
},
},
}}
isMissingInventory="Inventory Error"
isMissingSurvey="Survey Error"
/>
</tbody>
</table>
);
});