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'); 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( const wrapper = mountWithContexts(
<VariablesDetail value="" label="Variables" /> <VariablesDetail value="" label="Variables" />
); );
expect(wrapper.find('VariablesDetail___StyledCodeEditor').length).toBe(1); 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', () => { 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 () => { test('expect all tabs to exist, including Back to Schedules', async () => {
expect( expect(
wrapper.find('button[link="/templates/job_template/1/schedules"]').length wrapper.find('a[href="/templates/job_template/1/schedules"]').length
).toBe(1); ).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', () => { describe('User has edit permissions', () => {
beforeAll(() => { beforeAll(() => {
wrapper = mountWithContexts( wrapper = mountWithContexts(
<ScheduleListItem <table>
isSelected={false} <tbody>
onSelect={onSelect} <ScheduleListItem
schedule={mockSchedule} isSelected={false}
isMissingSurvey={false} onSelect={onSelect}
isMissingInventory={false} schedule={mockSchedule}
/> isMissingSurvey={false}
isMissingInventory={false}
/>
</tbody>
</table>
); );
}); });
@@ -190,22 +194,26 @@ describe('ScheduleListItem', () => {
describe('schedule has missing prompt data', () => { describe('schedule has missing prompt data', () => {
beforeAll(() => { beforeAll(() => {
wrapper = mountWithContexts( wrapper = mountWithContexts(
<ScheduleListItem <table>
isSelected={false} <tbody>
onSelect={onSelect} <ScheduleListItem
schedule={{ isSelected={false}
...mockSchedule, onSelect={onSelect}
summary_fields: { schedule={{
...mockSchedule.summary_fields, ...mockSchedule,
user_capabilities: { summary_fields: {
edit: false, ...mockSchedule.summary_fields,
delete: false, user_capabilities: {
}, edit: false,
}, delete: false,
}} },
isMissingInventory="Inventory Error" },
isMissingSurvey="Survey Error" }}
/> isMissingInventory="Inventory Error"
isMissingSurvey="Survey Error"
/>
</tbody>
</table>
); );
}); });