fix errors logged in tests (scheduls/organization)

This commit is contained in:
Keith J. Grant 2021-07-06 12:31:27 -07:00
parent ad2f042f97
commit 1b5fa9c799
8 changed files with 158 additions and 95 deletions

View File

@ -7,6 +7,7 @@ import {
number,
oneOfType,
shape,
node,
} from 'prop-types';
import { withRouter } from 'react-router-dom';
import { useField } from 'formik';
@ -206,7 +207,7 @@ const Item = shape({
Lookup.propTypes = {
id: string,
header: string,
modalDescription: string,
modalDescription: oneOfType([string, node]),
onChange: func.isRequired,
value: oneOfType([Item, arrayOf(Item)]),
multiple: bool,

View File

@ -73,7 +73,9 @@ describe('<ScheduleAdd />', () => {
/>
);
});
wrapper.update();
});
test('Successfully creates a schedule with repeat frequency: None (run once)', async () => {
await act(async () => {
wrapper.find('Formik').invoke('onSubmit')({
@ -95,6 +97,7 @@ describe('<ScheduleAdd />', () => {
'DTSTART;TZID=America/New_York:20200325T100000 RRULE:INTERVAL=1;COUNT=1;FREQ=MINUTELY',
});
});
test('Successfully creates a schedule with 10 minute repeat frequency after 10 occurrences', async () => {
await act(async () => {
wrapper.find('Formik').invoke('onSubmit')({
@ -117,6 +120,7 @@ describe('<ScheduleAdd />', () => {
'DTSTART;TZID=America/New_York:20200325T103000 RRULE:INTERVAL=10;FREQ=MINUTELY;COUNT=10',
});
});
test('Successfully creates a schedule with hourly repeat frequency ending on a specific date/time', async () => {
await act(async () => {
wrapper.find('Formik').invoke('onSubmit')({
@ -140,6 +144,7 @@ describe('<ScheduleAdd />', () => {
'DTSTART;TZID=America/New_York:20200325T104500 RRULE:INTERVAL=1;FREQ=HOURLY;UNTIL=20200326T104500',
});
});
test('Successfully creates a schedule with daily repeat frequency', async () => {
await act(async () => {
wrapper.find('Formik').invoke('onSubmit')({
@ -161,6 +166,7 @@ describe('<ScheduleAdd />', () => {
'DTSTART;TZID=America/New_York:20200325T104500 RRULE:INTERVAL=1;FREQ=DAILY',
});
});
test('Successfully creates a schedule with weekly repeat frequency on mon/wed/fri', async () => {
await act(async () => {
wrapper.find('Formik').invoke('onSubmit')({
@ -183,6 +189,7 @@ describe('<ScheduleAdd />', () => {
rrule: `DTSTART;TZID=America/New_York:20200325T104500 RRULE:INTERVAL=1;FREQ=WEEKLY;BYDAY=${RRule.MO},${RRule.WE},${RRule.FR}`,
});
});
test('Successfully creates a schedule with monthly repeat frequency on the first day of the month', async () => {
await act(async () => {
wrapper.find('Formik').invoke('onSubmit')({
@ -207,6 +214,7 @@ describe('<ScheduleAdd />', () => {
'DTSTART;TZID=America/New_York:20200401T104500 RRULE:INTERVAL=1;FREQ=MONTHLY;BYMONTHDAY=1',
});
});
test('Successfully creates a schedule with monthly repeat frequency on the last tuesday of the month', async () => {
await act(async () => {
wrapper.find('Formik').invoke('onSubmit')({
@ -259,6 +267,7 @@ describe('<ScheduleAdd />', () => {
'DTSTART;TZID=America/New_York:20200301T000000 RRULE:INTERVAL=1;FREQ=YEARLY;BYMONTH=3;BYMONTHDAY=1',
});
});
test('Successfully creates a schedule with yearly repeat frequency on the second Friday in April', async () => {
await act(async () => {
wrapper.find('Formik').invoke('onSubmit')({
@ -285,6 +294,7 @@ describe('<ScheduleAdd />', () => {
'DTSTART;TZID=America/New_York:20200410T111500 RRULE:INTERVAL=1;FREQ=YEARLY;BYSETPOS=2;BYDAY=FR;BYMONTH=4',
});
});
test('Successfully creates a schedule with yearly repeat frequency on the first weekday in October', async () => {
await act(async () => {
wrapper.find('Formik').invoke('onSubmit')({
@ -464,6 +474,7 @@ describe('<ScheduleAdd />', () => {
/>
);
});
scheduleSurveyWrapper.update();
await act(async () => {
scheduleSurveyWrapper.find('Formik').invoke('onSubmit')({
description: 'test description',

View File

@ -1,10 +1,7 @@
import React from 'react';
import { act } from 'react-dom/test-utils';
import { RRule } from 'rrule';
import {
mountWithContexts,
waitForElement,
} from '../../../../testUtils/enzymeHelpers';
import { mountWithContexts } from '../../../../testUtils/enzymeHelpers';
import {
SchedulesAPI,
InventoriesAPI,
@ -191,12 +188,13 @@ describe('<ScheduleEdit />', () => {
/>
);
});
await waitForElement(wrapper, 'ContentLoading', el => el.length === 0);
wrapper.update();
});
afterEach(() => {
wrapper.unmount();
jest.clearAllMocks();
});
test('Successfully creates a schedule with repeat frequency: None (run once)', async () => {
await act(async () => {
wrapper.find('Formik').invoke('onSubmit')({
@ -210,6 +208,7 @@ describe('<ScheduleEdit />', () => {
timezone: 'America/New_York',
});
});
expect(SchedulesAPI.update).toHaveBeenCalledWith(27, {
description: 'test description',
name: 'Run once schedule',
@ -218,6 +217,7 @@ describe('<ScheduleEdit />', () => {
'DTSTART;TZID=America/New_York:20200325T100000 RRULE:INTERVAL=1;COUNT=1;FREQ=MINUTELY',
});
});
test('Successfully creates a schedule with 10 minute repeat frequency after 10 occurrences', async () => {
await act(async () => {
wrapper.find('Formik').invoke('onSubmit')({
@ -241,6 +241,7 @@ describe('<ScheduleEdit />', () => {
'DTSTART;TZID=America/New_York:20200325T103000 RRULE:INTERVAL=10;FREQ=MINUTELY;COUNT=10',
});
});
test('Successfully creates a schedule with hourly repeat frequency ending on a specific date/time', async () => {
await act(async () => {
wrapper.find('Formik').invoke('onSubmit')({
@ -256,6 +257,7 @@ describe('<ScheduleEdit />', () => {
timezone: 'America/New_York',
});
});
expect(SchedulesAPI.update).toHaveBeenCalledWith(27, {
description: 'test description',
name: 'Run every hour until date',
@ -264,6 +266,7 @@ describe('<ScheduleEdit />', () => {
'DTSTART;TZID=America/New_York:20200325T104500 RRULE:INTERVAL=1;FREQ=HOURLY;UNTIL=20200326T104500',
});
});
test('Successfully creates a schedule with daily repeat frequency', async () => {
await act(async () => {
wrapper.find('Formik').invoke('onSubmit')({
@ -308,6 +311,7 @@ describe('<ScheduleEdit />', () => {
rrule: `DTSTART;TZID=America/New_York:20200325T104500 RRULE:INTERVAL=1;FREQ=WEEKLY;BYDAY=${RRule.MO},${RRule.WE},${RRule.FR}`,
});
});
test('Successfully creates a schedule with monthly repeat frequency on the first day of the month', async () => {
await act(async () => {
wrapper.find('Formik').invoke('onSubmit')({
@ -333,6 +337,7 @@ describe('<ScheduleEdit />', () => {
'DTSTART;TZID=America/New_York:20200401T104500 RRULE:INTERVAL=1;FREQ=MONTHLY;BYMONTHDAY=1',
});
});
test('Successfully creates a schedule with monthly repeat frequency on the last tuesday of the month', async () => {
await act(async () => {
wrapper.find('Formik').invoke('onSubmit')({
@ -362,6 +367,7 @@ describe('<ScheduleEdit />', () => {
'DTSTART;TZID=America/New_York:20200331T110000 RRULE:INTERVAL=1;FREQ=MONTHLY;BYSETPOS=-1;BYDAY=TU',
});
});
test('Successfully creates a schedule with yearly repeat frequency on the first day of March', async () => {
await act(async () => {
wrapper.find('Formik').invoke('onSubmit')({
@ -388,6 +394,7 @@ describe('<ScheduleEdit />', () => {
'DTSTART;TZID=America/New_York:20200301T000000 RRULE:INTERVAL=1;FREQ=YEARLY;BYMONTH=3;BYMONTHDAY=1',
});
});
test('Successfully creates a schedule with yearly repeat frequency on the second Friday in April', async () => {
await act(async () => {
wrapper.find('Formik').invoke('onSubmit')({
@ -416,6 +423,7 @@ describe('<ScheduleEdit />', () => {
'DTSTART;TZID=America/New_York:20200410T111500 RRULE:INTERVAL=1;FREQ=YEARLY;BYSETPOS=2;BYDAY=FR;BYMONTH=4',
});
});
test('Successfully creates a schedule with yearly repeat frequency on the first weekday in October', async () => {
await act(async () => {
wrapper.find('Formik').invoke('onSubmit')({
@ -653,6 +661,7 @@ describe('<ScheduleEdit />', () => {
'DTSTART;TZID=America/New_York:20200402T184500 RRULE:INTERVAL=1;COUNT=1;FREQ=MINUTELY',
});
});
test('should submit survey with default values properly, without opening prompt wizard', async () => {
let scheduleSurveyWrapper;
await act(async () => {
@ -741,6 +750,8 @@ describe('<ScheduleEdit />', () => {
/>
);
});
scheduleSurveyWrapper.update();
await act(async () => {
scheduleSurveyWrapper.find('Formik').invoke('onSubmit')({
description: 'test description',
@ -753,6 +764,7 @@ describe('<ScheduleEdit />', () => {
timezone: 'America/New_York',
});
});
expect(SchedulesAPI.update).toHaveBeenCalledWith(27, {
description: 'test description',
name: 'Run once schedule',

View File

@ -19,6 +19,7 @@ describe('<Schedules />', () => {
jobTemplate={jobTemplate}
loadSchedules={() => {}}
loadScheduleOptions={() => {}}
apiModel={{ createSchedule: () => {} }}
/>,
{

View File

@ -178,7 +178,6 @@ function ScheduleForm({
hasDaysToKeepField,
handleCancel,
handleSubmit,
schedule,
submitError,
resource,
@ -234,8 +233,14 @@ function ScheduleForm({
{
zonesOptions: [],
credentials: [],
isLoading: true,
}
);
useEffect(() => {
loadScheduleData();
}, [loadScheduleData]);
const missingRequiredInventory = useCallback(() => {
let missingInventory = false;
if (
@ -357,10 +362,6 @@ function ScheduleForm({
hasCredentialsThatPrompt,
]);
useEffect(() => {
loadScheduleData();
}, [loadScheduleData]);
let showPromptButton = false;
if (

View File

@ -168,6 +168,7 @@ describe('<ScheduleForm />', () => {
expect(wrapper.find('ContentError').length).toBe(1);
});
});
describe('Cancel', () => {
test('should make the appropriate callback', async () => {
const handleCancel = jest.fn();
@ -226,8 +227,10 @@ describe('<ScheduleForm />', () => {
expect(handleCancel).toHaveBeenCalledTimes(1);
});
});
describe('Prompted Schedule', () => {
let promptWrapper;
beforeEach(async () => {
SchedulesAPI.readZoneInfo.mockResolvedValue({
data: [
@ -284,8 +287,8 @@ describe('<ScheduleForm />', () => {
el => el.length > 0
);
});
afterEach(() => {
promptWrapper.unmount();
jest.clearAllMocks();
});
@ -375,6 +378,7 @@ describe('<ScheduleForm />', () => {
promptWrapper.update();
expect(promptWrapper.find('Wizard').length).toBe(0);
});
test('should render prompt button with disabled save button', async () => {
await act(async () => {
wrapper = mountWithContexts(
@ -423,6 +427,7 @@ describe('<ScheduleForm />', () => {
);
});
});
describe('Add', () => {
beforeAll(async () => {
SchedulesAPI.readZoneInfo.mockResolvedValue({
@ -473,9 +478,7 @@ describe('<ScheduleForm />', () => {
});
await waitForElement(wrapper, 'ContentLoading', el => el.length === 0);
});
afterAll(() => {
wrapper.unmount();
});
test('initially renders expected fields and values', () => {
const now = new Date();
const closestQuarterHour = new Date(
@ -503,6 +506,7 @@ describe('<ScheduleForm />', () => {
'none'
);
});
test('correct frequency details fields and values shown when frequency changed to minute', async () => {
const runFrequencySelect = wrapper.find(
'FormGroup[label="Run frequency"] FormSelect'
@ -526,6 +530,7 @@ describe('<ScheduleForm />', () => {
expect(wrapper.find('input#end-after').prop('checked')).toBe(false);
expect(wrapper.find('input#end-on-date').prop('checked')).toBe(false);
});
test('correct frequency details fields and values shown when frequency changed to hour', async () => {
const runFrequencySelect = wrapper.find(
'FormGroup[label="Run frequency"] FormSelect'
@ -549,6 +554,7 @@ describe('<ScheduleForm />', () => {
expect(wrapper.find('input#end-after').prop('checked')).toBe(false);
expect(wrapper.find('input#end-on-date').prop('checked')).toBe(false);
});
test('correct frequency details fields and values shown when frequency changed to day', async () => {
const runFrequencySelect = wrapper.find(
'FormGroup[label="Run frequency"] FormSelect'
@ -572,6 +578,7 @@ describe('<ScheduleForm />', () => {
expect(wrapper.find('input#end-after').prop('checked')).toBe(false);
expect(wrapper.find('input#end-on-date').prop('checked')).toBe(false);
});
test('correct frequency details fields and values shown when frequency changed to week', async () => {
const runFrequencySelect = wrapper.find(
'FormGroup[label="Run frequency"] FormSelect'
@ -595,6 +602,7 @@ describe('<ScheduleForm />', () => {
expect(wrapper.find('input#end-after').prop('checked')).toBe(false);
expect(wrapper.find('input#end-on-date').prop('checked')).toBe(false);
});
test('correct frequency details fields and values shown when frequency changed to month', async () => {
const runFrequencySelect = wrapper.find(
'FormGroup[label="Run frequency"] FormSelect'
@ -629,6 +637,7 @@ describe('<ScheduleForm />', () => {
expect(wrapper.find('select#schedule-run-on-day-month').length).toBe(0);
expect(wrapper.find('select#schedule-run-on-the-month').length).toBe(0);
});
test('correct frequency details fields and values shown when frequency changed to year', async () => {
const runFrequencySelect = wrapper.find(
'FormGroup[label="Run frequency"] FormSelect'
@ -663,6 +672,7 @@ describe('<ScheduleForm />', () => {
expect(wrapper.find('select#schedule-run-on-day-month').length).toBe(1);
expect(wrapper.find('select#schedule-run-on-the-month').length).toBe(1);
});
test('occurrences field properly shown when end after selection is made', async () => {
await act(async () => {
wrapper
@ -690,6 +700,7 @@ describe('<ScheduleForm />', () => {
});
wrapper.update();
});
test('error shown when end date/time comes before start date/time', async () => {
await act(async () => {
wrapper
@ -728,6 +739,7 @@ describe('<ScheduleForm />', () => {
'Please select an end date/time that comes after the start date/time.'
);
});
test('error shown when on day number is not between 1 and 31', async () => {
act(() => {
wrapper.find('select[id="schedule-frequency"]').invoke('onChange')(
@ -761,6 +773,7 @@ describe('<ScheduleForm />', () => {
);
});
});
describe('Edit', () => {
beforeEach(async () => {
SchedulesAPI.readZoneInfo.mockResolvedValue({
@ -773,12 +786,12 @@ describe('<ScheduleForm />', () => {
SchedulesAPI.readCredentials.mockResolvedValue(credentials);
});
afterEach(() => {
wrapper.unmount();
jest.clearAllMocks();
});
test('should make API calls to fetch credentials, launch configuration, and survey configuration', async () => {
test('should make API calls to fetch credentials, launch configuration, and survey configuration', async () => {
await act(async () => {
wrapper = mountWithContexts(
<ScheduleForm
@ -906,6 +919,7 @@ describe('<ScheduleForm />', () => {
/>
);
});
wrapper.update();
expect(wrapper.find('ScheduleForm').length).toBe(1);
defaultFieldsVisible();
expect(wrapper.find('FormGroup[label="Run every"]').length).toBe(0);
@ -920,6 +934,7 @@ describe('<ScheduleForm />', () => {
'none'
);
});
test('initially renders expected fields and values with existing schedule that runs every 10 minutes', async () => {
await act(async () => {
wrapper = mountWithContexts(
@ -941,6 +956,8 @@ describe('<ScheduleForm />', () => {
/>
);
});
wrapper.update();
expect(wrapper.find('ScheduleForm').length).toBe(1);
defaultFieldsVisible();
expect(wrapper.find('FormGroup[label="End"]').length).toBe(1);
@ -959,6 +976,7 @@ describe('<ScheduleForm />', () => {
expect(wrapper.find('input#end-after').prop('checked')).toBe(false);
expect(wrapper.find('input#end-on-date').prop('checked')).toBe(false);
});
test('initially renders expected fields and values with existing schedule that runs every hour 10 times', async () => {
await act(async () => {
wrapper = mountWithContexts(
@ -981,6 +999,8 @@ describe('<ScheduleForm />', () => {
/>
);
});
wrapper.update();
expect(wrapper.find('ScheduleForm').length).toBe(1);
defaultFieldsVisible();
expect(wrapper.find('FormGroup[label="End"]').length).toBe(1);
@ -1000,6 +1020,7 @@ describe('<ScheduleForm />', () => {
expect(wrapper.find('input#end-on-date').prop('checked')).toBe(false);
expect(wrapper.find('input#schedule-occurrences').prop('value')).toBe(10);
});
test('initially renders expected fields and values with existing schedule that runs every day', async () => {
await act(async () => {
wrapper = mountWithContexts(
@ -1021,25 +1042,28 @@ describe('<ScheduleForm />', () => {
}}
/>
);
expect(wrapper.find('ScheduleForm').length).toBe(1);
defaultFieldsVisible();
expect(wrapper.find('FormGroup[label="Run every"]').length).toBe(1);
expect(wrapper.find('FormGroup[label="End"]').length).toBe(1);
expect(wrapper.find('FormGroup[label="On days"]').length).toBe(0);
expect(wrapper.find('FormGroup[label="Run on"]').length).toBe(0);
expect(wrapper.find('FormGroup[label="Occurrences"]').length).toBe(0);
expect(wrapper.find('FormGroup[label="End date/time"]').length).toBe(0);
nonRRuleValuesMatch();
expect(wrapper.find('select#schedule-frequency').prop('value')).toBe(
'day'
);
expect(wrapper.find('input#end-never').prop('checked')).toBe(true);
expect(wrapper.find('input#end-after').prop('checked')).toBe(false);
expect(wrapper.find('input#end-on-date').prop('checked')).toBe(false);
expect(wrapper.find('input#schedule-run-every').prop('value')).toBe(1);
});
wrapper.update();
expect(wrapper.find('ScheduleForm').length).toBe(1);
defaultFieldsVisible();
expect(wrapper.find('FormGroup[label="Run every"]').length).toBe(1);
expect(wrapper.find('FormGroup[label="End"]').length).toBe(1);
expect(wrapper.find('FormGroup[label="On days"]').length).toBe(0);
expect(wrapper.find('FormGroup[label="Run on"]').length).toBe(0);
expect(wrapper.find('FormGroup[label="Occurrences"]').length).toBe(0);
expect(wrapper.find('FormGroup[label="End date/time"]').length).toBe(0);
nonRRuleValuesMatch();
expect(wrapper.find('select#schedule-frequency').prop('value')).toBe(
'day'
);
expect(wrapper.find('input#end-never').prop('checked')).toBe(true);
expect(wrapper.find('input#end-after').prop('checked')).toBe(false);
expect(wrapper.find('input#end-on-date').prop('checked')).toBe(false);
expect(wrapper.find('input#schedule-run-every').prop('value')).toBe(1);
});
test('initially renders expected fields and values with existing schedule that runs every week on m/w/f until Jan 1, 2020', async () => {
await act(async () => {
wrapper = mountWithContexts(
@ -1062,6 +1086,8 @@ describe('<ScheduleForm />', () => {
/>
);
});
wrapper.update();
expect(wrapper.find('ScheduleForm').length).toBe(1);
defaultFieldsVisible();
expect(wrapper.find('FormGroup[label="End"]').length).toBe(1);
@ -1107,6 +1133,7 @@ describe('<ScheduleForm />', () => {
wrapper.find('TimePicker[aria-label="End time"]').prop('value')
).toBe('1:00 AM');
});
test('initially renders expected fields and values with existing schedule that runs every month on the last weekday', async () => {
await act(async () => {
wrapper = mountWithContexts(
@ -1128,37 +1155,43 @@ describe('<ScheduleForm />', () => {
}}
/>
);
expect(wrapper.find('ScheduleForm').length).toBe(1);
defaultFieldsVisible();
expect(wrapper.find('FormGroup[label="End"]').length).toBe(1);
expect(wrapper.find('FormGroup[label="Run every"]').length).toBe(1);
expect(wrapper.find('FormGroup[label="Run on"]').length).toBe(1);
expect(wrapper.find('FormGroup[label="End date/time"]').length).toBe(0);
expect(wrapper.find('FormGroup[label="On days"]').length).toBe(0);
expect(wrapper.find('FormGroup[label="Occurrences"]').length).toBe(0);
nonRRuleValuesMatch();
expect(wrapper.find('select#schedule-frequency').prop('value')).toBe(
'month'
);
expect(wrapper.find('input#end-never').prop('checked')).toBe(true);
expect(wrapper.find('input#end-after').prop('checked')).toBe(false);
expect(wrapper.find('input#end-on-date').prop('checked')).toBe(false);
expect(wrapper.find('input#schedule-run-every').prop('value')).toBe(1);
expect(wrapper.find('input#schedule-run-on-day').prop('checked')).toBe(
false
);
expect(wrapper.find('input#schedule-run-on-the').prop('checked')).toBe(
true
);
expect(
wrapper.find('select#schedule-run-on-the-occurrence').prop('value')
).toBe(-1);
expect(
wrapper.find('select#schedule-run-on-the-day').prop('value')
).toBe('weekday');
});
wrapper.update();
expect(wrapper.find('ScheduleForm').length).toBe(1);
defaultFieldsVisible();
expect(wrapper.find('ScheduleForm').length).toBe(1);
defaultFieldsVisible();
expect(wrapper.find('FormGroup[label="End"]').length).toBe(1);
expect(wrapper.find('FormGroup[label="Run every"]').length).toBe(1);
expect(wrapper.find('FormGroup[label="Run on"]').length).toBe(1);
expect(wrapper.find('FormGroup[label="End date/time"]').length).toBe(0);
expect(wrapper.find('FormGroup[label="On days"]').length).toBe(0);
expect(wrapper.find('FormGroup[label="Occurrences"]').length).toBe(0);
nonRRuleValuesMatch();
expect(wrapper.find('select#schedule-frequency').prop('value')).toBe(
'month'
);
expect(wrapper.find('input#end-never').prop('checked')).toBe(true);
expect(wrapper.find('input#end-after').prop('checked')).toBe(false);
expect(wrapper.find('input#end-on-date').prop('checked')).toBe(false);
expect(wrapper.find('input#schedule-run-every').prop('value')).toBe(1);
expect(wrapper.find('input#schedule-run-on-day').prop('checked')).toBe(
false
);
expect(wrapper.find('input#schedule-run-on-the').prop('checked')).toBe(
true
);
expect(
wrapper.find('select#schedule-run-on-the-occurrence').prop('value')
).toBe(-1);
expect(wrapper.find('select#schedule-run-on-the-day').prop('value')).toBe(
'weekday'
);
});
test('initially renders expected fields and values with existing schedule that runs every year on the May 6', async () => {
await act(async () => {
wrapper = mountWithContexts(
@ -1180,36 +1213,38 @@ describe('<ScheduleForm />', () => {
}}
/>
);
expect(wrapper.find('ScheduleForm').length).toBe(1);
defaultFieldsVisible();
expect(wrapper.find('FormGroup[label="End"]').length).toBe(1);
expect(wrapper.find('FormGroup[label="Run every"]').length).toBe(1);
expect(wrapper.find('FormGroup[label="Run on"]').length).toBe(1);
expect(wrapper.find('FormGroup[label="End date/time"]').length).toBe(0);
expect(wrapper.find('FormGroup[label="On days"]').length).toBe(0);
expect(wrapper.find('FormGroup[label="Occurrences"]').length).toBe(0);
nonRRuleValuesMatch();
expect(wrapper.find('select#schedule-frequency').prop('value')).toBe(
'year'
);
expect(wrapper.find('input#end-never').prop('checked')).toBe(true);
expect(wrapper.find('input#end-after').prop('checked')).toBe(false);
expect(wrapper.find('input#end-on-date').prop('checked')).toBe(false);
expect(wrapper.find('input#schedule-run-every').prop('value')).toBe(1);
expect(wrapper.find('input#schedule-run-on-day').prop('checked')).toBe(
true
);
expect(wrapper.find('input#schedule-run-on-the').prop('checked')).toBe(
false
);
expect(
wrapper.find('select#schedule-run-on-day-month').prop('value')
).toBe(5);
expect(
wrapper.find('input#schedule-run-on-day-number').prop('value')
).toBe(6);
});
wrapper.update();
expect(wrapper.find('ScheduleForm').length).toBe(1);
defaultFieldsVisible();
expect(wrapper.find('FormGroup[label="End"]').length).toBe(1);
expect(wrapper.find('FormGroup[label="Run every"]').length).toBe(1);
expect(wrapper.find('FormGroup[label="Run on"]').length).toBe(1);
expect(wrapper.find('FormGroup[label="End date/time"]').length).toBe(0);
expect(wrapper.find('FormGroup[label="On days"]').length).toBe(0);
expect(wrapper.find('FormGroup[label="Occurrences"]').length).toBe(0);
nonRRuleValuesMatch();
expect(wrapper.find('select#schedule-frequency').prop('value')).toBe(
'year'
);
expect(wrapper.find('input#end-never').prop('checked')).toBe(true);
expect(wrapper.find('input#end-after').prop('checked')).toBe(false);
expect(wrapper.find('input#end-on-date').prop('checked')).toBe(false);
expect(wrapper.find('input#schedule-run-every').prop('value')).toBe(1);
expect(wrapper.find('input#schedule-run-on-day').prop('checked')).toBe(
true
);
expect(wrapper.find('input#schedule-run-on-the').prop('checked')).toBe(
false
);
expect(
wrapper.find('select#schedule-run-on-day-month').prop('value')
).toBe(5);
expect(
wrapper.find('input#schedule-run-on-day-number').prop('value')
).toBe(6);
});
});
});

View File

@ -124,7 +124,7 @@ function OrganizationDetail({ organization }) {
value={
<ChipGroup numChips={5} totalChips={instanceGroups.length}>
{instanceGroups.map(ig => (
<Link to={`${buildLinkURL(ig)}${ig.id}/details`}>
<Link to={`${buildLinkURL(ig)}${ig.id}/details`} key={ig.id}>
<Chip key={ig.id} isReadOnly>
{ig.name}
</Chip>

View File

@ -39,7 +39,9 @@ describe('<OrganizationEdit />', () => {
description: 'new description',
default_environment: null,
};
wrapper.find('OrganizationForm').prop('onSubmit')(updatedOrgData, [], []);
await act(async () => {
wrapper.find('OrganizationForm').prop('onSubmit')(updatedOrgData, [], []);
});
expect(OrganizationsAPI.update).toHaveBeenCalledWith(1, updatedOrgData);
});