mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 18:07:36 -02:30
fix errors logged in tests (scheduls/organization)
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
|||||||
number,
|
number,
|
||||||
oneOfType,
|
oneOfType,
|
||||||
shape,
|
shape,
|
||||||
|
node,
|
||||||
} from 'prop-types';
|
} from 'prop-types';
|
||||||
import { withRouter } from 'react-router-dom';
|
import { withRouter } from 'react-router-dom';
|
||||||
import { useField } from 'formik';
|
import { useField } from 'formik';
|
||||||
@@ -206,7 +207,7 @@ const Item = shape({
|
|||||||
Lookup.propTypes = {
|
Lookup.propTypes = {
|
||||||
id: string,
|
id: string,
|
||||||
header: string,
|
header: string,
|
||||||
modalDescription: string,
|
modalDescription: oneOfType([string, node]),
|
||||||
onChange: func.isRequired,
|
onChange: func.isRequired,
|
||||||
value: oneOfType([Item, arrayOf(Item)]),
|
value: oneOfType([Item, arrayOf(Item)]),
|
||||||
multiple: bool,
|
multiple: bool,
|
||||||
|
|||||||
@@ -73,7 +73,9 @@ describe('<ScheduleAdd />', () => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
wrapper.update();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Successfully creates a schedule with repeat frequency: None (run once)', async () => {
|
test('Successfully creates a schedule with repeat frequency: None (run once)', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Formik').invoke('onSubmit')({
|
wrapper.find('Formik').invoke('onSubmit')({
|
||||||
@@ -95,6 +97,7 @@ describe('<ScheduleAdd />', () => {
|
|||||||
'DTSTART;TZID=America/New_York:20200325T100000 RRULE:INTERVAL=1;COUNT=1;FREQ=MINUTELY',
|
'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 () => {
|
test('Successfully creates a schedule with 10 minute repeat frequency after 10 occurrences', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Formik').invoke('onSubmit')({
|
wrapper.find('Formik').invoke('onSubmit')({
|
||||||
@@ -117,6 +120,7 @@ describe('<ScheduleAdd />', () => {
|
|||||||
'DTSTART;TZID=America/New_York:20200325T103000 RRULE:INTERVAL=10;FREQ=MINUTELY;COUNT=10',
|
'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 () => {
|
test('Successfully creates a schedule with hourly repeat frequency ending on a specific date/time', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Formik').invoke('onSubmit')({
|
wrapper.find('Formik').invoke('onSubmit')({
|
||||||
@@ -140,6 +144,7 @@ describe('<ScheduleAdd />', () => {
|
|||||||
'DTSTART;TZID=America/New_York:20200325T104500 RRULE:INTERVAL=1;FREQ=HOURLY;UNTIL=20200326T104500',
|
'DTSTART;TZID=America/New_York:20200325T104500 RRULE:INTERVAL=1;FREQ=HOURLY;UNTIL=20200326T104500',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Successfully creates a schedule with daily repeat frequency', async () => {
|
test('Successfully creates a schedule with daily repeat frequency', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Formik').invoke('onSubmit')({
|
wrapper.find('Formik').invoke('onSubmit')({
|
||||||
@@ -161,6 +166,7 @@ describe('<ScheduleAdd />', () => {
|
|||||||
'DTSTART;TZID=America/New_York:20200325T104500 RRULE:INTERVAL=1;FREQ=DAILY',
|
'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 () => {
|
test('Successfully creates a schedule with weekly repeat frequency on mon/wed/fri', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Formik').invoke('onSubmit')({
|
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}`,
|
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 () => {
|
test('Successfully creates a schedule with monthly repeat frequency on the first day of the month', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Formik').invoke('onSubmit')({
|
wrapper.find('Formik').invoke('onSubmit')({
|
||||||
@@ -207,6 +214,7 @@ describe('<ScheduleAdd />', () => {
|
|||||||
'DTSTART;TZID=America/New_York:20200401T104500 RRULE:INTERVAL=1;FREQ=MONTHLY;BYMONTHDAY=1',
|
'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 () => {
|
test('Successfully creates a schedule with monthly repeat frequency on the last tuesday of the month', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Formik').invoke('onSubmit')({
|
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',
|
'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 () => {
|
test('Successfully creates a schedule with yearly repeat frequency on the second Friday in April', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Formik').invoke('onSubmit')({
|
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',
|
'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 () => {
|
test('Successfully creates a schedule with yearly repeat frequency on the first weekday in October', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Formik').invoke('onSubmit')({
|
wrapper.find('Formik').invoke('onSubmit')({
|
||||||
@@ -464,6 +474,7 @@ describe('<ScheduleAdd />', () => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
scheduleSurveyWrapper.update();
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
scheduleSurveyWrapper.find('Formik').invoke('onSubmit')({
|
scheduleSurveyWrapper.find('Formik').invoke('onSubmit')({
|
||||||
description: 'test description',
|
description: 'test description',
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { act } from 'react-dom/test-utils';
|
import { act } from 'react-dom/test-utils';
|
||||||
import { RRule } from 'rrule';
|
import { RRule } from 'rrule';
|
||||||
import {
|
import { mountWithContexts } from '../../../../testUtils/enzymeHelpers';
|
||||||
mountWithContexts,
|
|
||||||
waitForElement,
|
|
||||||
} from '../../../../testUtils/enzymeHelpers';
|
|
||||||
import {
|
import {
|
||||||
SchedulesAPI,
|
SchedulesAPI,
|
||||||
InventoriesAPI,
|
InventoriesAPI,
|
||||||
@@ -191,12 +188,13 @@ describe('<ScheduleEdit />', () => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
await waitForElement(wrapper, 'ContentLoading', el => el.length === 0);
|
wrapper.update();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
wrapper.unmount();
|
|
||||||
jest.clearAllMocks();
|
jest.clearAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Successfully creates a schedule with repeat frequency: None (run once)', async () => {
|
test('Successfully creates a schedule with repeat frequency: None (run once)', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Formik').invoke('onSubmit')({
|
wrapper.find('Formik').invoke('onSubmit')({
|
||||||
@@ -210,6 +208,7 @@ describe('<ScheduleEdit />', () => {
|
|||||||
timezone: 'America/New_York',
|
timezone: 'America/New_York',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(SchedulesAPI.update).toHaveBeenCalledWith(27, {
|
expect(SchedulesAPI.update).toHaveBeenCalledWith(27, {
|
||||||
description: 'test description',
|
description: 'test description',
|
||||||
name: 'Run once schedule',
|
name: 'Run once schedule',
|
||||||
@@ -218,6 +217,7 @@ describe('<ScheduleEdit />', () => {
|
|||||||
'DTSTART;TZID=America/New_York:20200325T100000 RRULE:INTERVAL=1;COUNT=1;FREQ=MINUTELY',
|
'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 () => {
|
test('Successfully creates a schedule with 10 minute repeat frequency after 10 occurrences', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Formik').invoke('onSubmit')({
|
wrapper.find('Formik').invoke('onSubmit')({
|
||||||
@@ -241,6 +241,7 @@ describe('<ScheduleEdit />', () => {
|
|||||||
'DTSTART;TZID=America/New_York:20200325T103000 RRULE:INTERVAL=10;FREQ=MINUTELY;COUNT=10',
|
'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 () => {
|
test('Successfully creates a schedule with hourly repeat frequency ending on a specific date/time', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Formik').invoke('onSubmit')({
|
wrapper.find('Formik').invoke('onSubmit')({
|
||||||
@@ -256,6 +257,7 @@ describe('<ScheduleEdit />', () => {
|
|||||||
timezone: 'America/New_York',
|
timezone: 'America/New_York',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(SchedulesAPI.update).toHaveBeenCalledWith(27, {
|
expect(SchedulesAPI.update).toHaveBeenCalledWith(27, {
|
||||||
description: 'test description',
|
description: 'test description',
|
||||||
name: 'Run every hour until date',
|
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',
|
'DTSTART;TZID=America/New_York:20200325T104500 RRULE:INTERVAL=1;FREQ=HOURLY;UNTIL=20200326T104500',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Successfully creates a schedule with daily repeat frequency', async () => {
|
test('Successfully creates a schedule with daily repeat frequency', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Formik').invoke('onSubmit')({
|
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}`,
|
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 () => {
|
test('Successfully creates a schedule with monthly repeat frequency on the first day of the month', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Formik').invoke('onSubmit')({
|
wrapper.find('Formik').invoke('onSubmit')({
|
||||||
@@ -333,6 +337,7 @@ describe('<ScheduleEdit />', () => {
|
|||||||
'DTSTART;TZID=America/New_York:20200401T104500 RRULE:INTERVAL=1;FREQ=MONTHLY;BYMONTHDAY=1',
|
'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 () => {
|
test('Successfully creates a schedule with monthly repeat frequency on the last tuesday of the month', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Formik').invoke('onSubmit')({
|
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',
|
'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 () => {
|
test('Successfully creates a schedule with yearly repeat frequency on the first day of March', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Formik').invoke('onSubmit')({
|
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',
|
'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 () => {
|
test('Successfully creates a schedule with yearly repeat frequency on the second Friday in April', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Formik').invoke('onSubmit')({
|
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',
|
'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 () => {
|
test('Successfully creates a schedule with yearly repeat frequency on the first weekday in October', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Formik').invoke('onSubmit')({
|
wrapper.find('Formik').invoke('onSubmit')({
|
||||||
@@ -653,6 +661,7 @@ describe('<ScheduleEdit />', () => {
|
|||||||
'DTSTART;TZID=America/New_York:20200402T184500 RRULE:INTERVAL=1;COUNT=1;FREQ=MINUTELY',
|
'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 () => {
|
test('should submit survey with default values properly, without opening prompt wizard', async () => {
|
||||||
let scheduleSurveyWrapper;
|
let scheduleSurveyWrapper;
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
@@ -741,6 +750,8 @@ describe('<ScheduleEdit />', () => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
scheduleSurveyWrapper.update();
|
||||||
|
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
scheduleSurveyWrapper.find('Formik').invoke('onSubmit')({
|
scheduleSurveyWrapper.find('Formik').invoke('onSubmit')({
|
||||||
description: 'test description',
|
description: 'test description',
|
||||||
@@ -753,6 +764,7 @@ describe('<ScheduleEdit />', () => {
|
|||||||
timezone: 'America/New_York',
|
timezone: 'America/New_York',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(SchedulesAPI.update).toHaveBeenCalledWith(27, {
|
expect(SchedulesAPI.update).toHaveBeenCalledWith(27, {
|
||||||
description: 'test description',
|
description: 'test description',
|
||||||
name: 'Run once schedule',
|
name: 'Run once schedule',
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ describe('<Schedules />', () => {
|
|||||||
jobTemplate={jobTemplate}
|
jobTemplate={jobTemplate}
|
||||||
loadSchedules={() => {}}
|
loadSchedules={() => {}}
|
||||||
loadScheduleOptions={() => {}}
|
loadScheduleOptions={() => {}}
|
||||||
|
apiModel={{ createSchedule: () => {} }}
|
||||||
/>,
|
/>,
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -178,7 +178,6 @@ function ScheduleForm({
|
|||||||
hasDaysToKeepField,
|
hasDaysToKeepField,
|
||||||
handleCancel,
|
handleCancel,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
|
|
||||||
schedule,
|
schedule,
|
||||||
submitError,
|
submitError,
|
||||||
resource,
|
resource,
|
||||||
@@ -234,8 +233,14 @@ function ScheduleForm({
|
|||||||
{
|
{
|
||||||
zonesOptions: [],
|
zonesOptions: [],
|
||||||
credentials: [],
|
credentials: [],
|
||||||
|
isLoading: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
loadScheduleData();
|
||||||
|
}, [loadScheduleData]);
|
||||||
|
|
||||||
const missingRequiredInventory = useCallback(() => {
|
const missingRequiredInventory = useCallback(() => {
|
||||||
let missingInventory = false;
|
let missingInventory = false;
|
||||||
if (
|
if (
|
||||||
@@ -357,10 +362,6 @@ function ScheduleForm({
|
|||||||
hasCredentialsThatPrompt,
|
hasCredentialsThatPrompt,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
loadScheduleData();
|
|
||||||
}, [loadScheduleData]);
|
|
||||||
|
|
||||||
let showPromptButton = false;
|
let showPromptButton = false;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ describe('<ScheduleForm />', () => {
|
|||||||
expect(wrapper.find('ContentError').length).toBe(1);
|
expect(wrapper.find('ContentError').length).toBe(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Cancel', () => {
|
describe('Cancel', () => {
|
||||||
test('should make the appropriate callback', async () => {
|
test('should make the appropriate callback', async () => {
|
||||||
const handleCancel = jest.fn();
|
const handleCancel = jest.fn();
|
||||||
@@ -226,8 +227,10 @@ describe('<ScheduleForm />', () => {
|
|||||||
expect(handleCancel).toHaveBeenCalledTimes(1);
|
expect(handleCancel).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Prompted Schedule', () => {
|
describe('Prompted Schedule', () => {
|
||||||
let promptWrapper;
|
let promptWrapper;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
SchedulesAPI.readZoneInfo.mockResolvedValue({
|
SchedulesAPI.readZoneInfo.mockResolvedValue({
|
||||||
data: [
|
data: [
|
||||||
@@ -284,8 +287,8 @@ describe('<ScheduleForm />', () => {
|
|||||||
el => el.length > 0
|
el => el.length > 0
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
promptWrapper.unmount();
|
|
||||||
jest.clearAllMocks();
|
jest.clearAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -375,6 +378,7 @@ describe('<ScheduleForm />', () => {
|
|||||||
promptWrapper.update();
|
promptWrapper.update();
|
||||||
expect(promptWrapper.find('Wizard').length).toBe(0);
|
expect(promptWrapper.find('Wizard').length).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should render prompt button with disabled save button', async () => {
|
test('should render prompt button with disabled save button', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper = mountWithContexts(
|
wrapper = mountWithContexts(
|
||||||
@@ -423,6 +427,7 @@ describe('<ScheduleForm />', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Add', () => {
|
describe('Add', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
SchedulesAPI.readZoneInfo.mockResolvedValue({
|
SchedulesAPI.readZoneInfo.mockResolvedValue({
|
||||||
@@ -473,9 +478,7 @@ describe('<ScheduleForm />', () => {
|
|||||||
});
|
});
|
||||||
await waitForElement(wrapper, 'ContentLoading', el => el.length === 0);
|
await waitForElement(wrapper, 'ContentLoading', el => el.length === 0);
|
||||||
});
|
});
|
||||||
afterAll(() => {
|
|
||||||
wrapper.unmount();
|
|
||||||
});
|
|
||||||
test('initially renders expected fields and values', () => {
|
test('initially renders expected fields and values', () => {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const closestQuarterHour = new Date(
|
const closestQuarterHour = new Date(
|
||||||
@@ -503,6 +506,7 @@ describe('<ScheduleForm />', () => {
|
|||||||
'none'
|
'none'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('correct frequency details fields and values shown when frequency changed to minute', async () => {
|
test('correct frequency details fields and values shown when frequency changed to minute', async () => {
|
||||||
const runFrequencySelect = wrapper.find(
|
const runFrequencySelect = wrapper.find(
|
||||||
'FormGroup[label="Run frequency"] FormSelect'
|
'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-after').prop('checked')).toBe(false);
|
||||||
expect(wrapper.find('input#end-on-date').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 () => {
|
test('correct frequency details fields and values shown when frequency changed to hour', async () => {
|
||||||
const runFrequencySelect = wrapper.find(
|
const runFrequencySelect = wrapper.find(
|
||||||
'FormGroup[label="Run frequency"] FormSelect'
|
'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-after').prop('checked')).toBe(false);
|
||||||
expect(wrapper.find('input#end-on-date').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 () => {
|
test('correct frequency details fields and values shown when frequency changed to day', async () => {
|
||||||
const runFrequencySelect = wrapper.find(
|
const runFrequencySelect = wrapper.find(
|
||||||
'FormGroup[label="Run frequency"] FormSelect'
|
'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-after').prop('checked')).toBe(false);
|
||||||
expect(wrapper.find('input#end-on-date').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 () => {
|
test('correct frequency details fields and values shown when frequency changed to week', async () => {
|
||||||
const runFrequencySelect = wrapper.find(
|
const runFrequencySelect = wrapper.find(
|
||||||
'FormGroup[label="Run frequency"] FormSelect'
|
'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-after').prop('checked')).toBe(false);
|
||||||
expect(wrapper.find('input#end-on-date').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 () => {
|
test('correct frequency details fields and values shown when frequency changed to month', async () => {
|
||||||
const runFrequencySelect = wrapper.find(
|
const runFrequencySelect = wrapper.find(
|
||||||
'FormGroup[label="Run frequency"] FormSelect'
|
'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-day-month').length).toBe(0);
|
||||||
expect(wrapper.find('select#schedule-run-on-the-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 () => {
|
test('correct frequency details fields and values shown when frequency changed to year', async () => {
|
||||||
const runFrequencySelect = wrapper.find(
|
const runFrequencySelect = wrapper.find(
|
||||||
'FormGroup[label="Run frequency"] FormSelect'
|
'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-day-month').length).toBe(1);
|
||||||
expect(wrapper.find('select#schedule-run-on-the-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 () => {
|
test('occurrences field properly shown when end after selection is made', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper
|
wrapper
|
||||||
@@ -690,6 +700,7 @@ describe('<ScheduleForm />', () => {
|
|||||||
});
|
});
|
||||||
wrapper.update();
|
wrapper.update();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('error shown when end date/time comes before start date/time', async () => {
|
test('error shown when end date/time comes before start date/time', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper
|
wrapper
|
||||||
@@ -728,6 +739,7 @@ describe('<ScheduleForm />', () => {
|
|||||||
'Please select an end date/time that comes after the start date/time.'
|
'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 () => {
|
test('error shown when on day number is not between 1 and 31', async () => {
|
||||||
act(() => {
|
act(() => {
|
||||||
wrapper.find('select[id="schedule-frequency"]').invoke('onChange')(
|
wrapper.find('select[id="schedule-frequency"]').invoke('onChange')(
|
||||||
@@ -761,6 +773,7 @@ describe('<ScheduleForm />', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Edit', () => {
|
describe('Edit', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
SchedulesAPI.readZoneInfo.mockResolvedValue({
|
SchedulesAPI.readZoneInfo.mockResolvedValue({
|
||||||
@@ -773,12 +786,12 @@ describe('<ScheduleForm />', () => {
|
|||||||
|
|
||||||
SchedulesAPI.readCredentials.mockResolvedValue(credentials);
|
SchedulesAPI.readCredentials.mockResolvedValue(credentials);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
wrapper.unmount();
|
|
||||||
jest.clearAllMocks();
|
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 () => {
|
await act(async () => {
|
||||||
wrapper = mountWithContexts(
|
wrapper = mountWithContexts(
|
||||||
<ScheduleForm
|
<ScheduleForm
|
||||||
@@ -906,6 +919,7 @@ describe('<ScheduleForm />', () => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
wrapper.update();
|
||||||
expect(wrapper.find('ScheduleForm').length).toBe(1);
|
expect(wrapper.find('ScheduleForm').length).toBe(1);
|
||||||
defaultFieldsVisible();
|
defaultFieldsVisible();
|
||||||
expect(wrapper.find('FormGroup[label="Run every"]').length).toBe(0);
|
expect(wrapper.find('FormGroup[label="Run every"]').length).toBe(0);
|
||||||
@@ -920,6 +934,7 @@ describe('<ScheduleForm />', () => {
|
|||||||
'none'
|
'none'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('initially renders expected fields and values with existing schedule that runs every 10 minutes', async () => {
|
test('initially renders expected fields and values with existing schedule that runs every 10 minutes', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper = mountWithContexts(
|
wrapper = mountWithContexts(
|
||||||
@@ -941,6 +956,8 @@ describe('<ScheduleForm />', () => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
wrapper.update();
|
||||||
|
|
||||||
expect(wrapper.find('ScheduleForm').length).toBe(1);
|
expect(wrapper.find('ScheduleForm').length).toBe(1);
|
||||||
defaultFieldsVisible();
|
defaultFieldsVisible();
|
||||||
expect(wrapper.find('FormGroup[label="End"]').length).toBe(1);
|
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-after').prop('checked')).toBe(false);
|
||||||
expect(wrapper.find('input#end-on-date').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 () => {
|
test('initially renders expected fields and values with existing schedule that runs every hour 10 times', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper = mountWithContexts(
|
wrapper = mountWithContexts(
|
||||||
@@ -981,6 +999,8 @@ describe('<ScheduleForm />', () => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
wrapper.update();
|
||||||
|
|
||||||
expect(wrapper.find('ScheduleForm').length).toBe(1);
|
expect(wrapper.find('ScheduleForm').length).toBe(1);
|
||||||
defaultFieldsVisible();
|
defaultFieldsVisible();
|
||||||
expect(wrapper.find('FormGroup[label="End"]').length).toBe(1);
|
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#end-on-date').prop('checked')).toBe(false);
|
||||||
expect(wrapper.find('input#schedule-occurrences').prop('value')).toBe(10);
|
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 () => {
|
test('initially renders expected fields and values with existing schedule that runs every day', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper = mountWithContexts(
|
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 () => {
|
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 () => {
|
await act(async () => {
|
||||||
wrapper = mountWithContexts(
|
wrapper = mountWithContexts(
|
||||||
@@ -1062,6 +1086,8 @@ describe('<ScheduleForm />', () => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
wrapper.update();
|
||||||
|
|
||||||
expect(wrapper.find('ScheduleForm').length).toBe(1);
|
expect(wrapper.find('ScheduleForm').length).toBe(1);
|
||||||
defaultFieldsVisible();
|
defaultFieldsVisible();
|
||||||
expect(wrapper.find('FormGroup[label="End"]').length).toBe(1);
|
expect(wrapper.find('FormGroup[label="End"]').length).toBe(1);
|
||||||
@@ -1107,6 +1133,7 @@ describe('<ScheduleForm />', () => {
|
|||||||
wrapper.find('TimePicker[aria-label="End time"]').prop('value')
|
wrapper.find('TimePicker[aria-label="End time"]').prop('value')
|
||||||
).toBe('1:00 AM');
|
).toBe('1:00 AM');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('initially renders expected fields and values with existing schedule that runs every month on the last weekday', async () => {
|
test('initially renders expected fields and values with existing schedule that runs every month on the last weekday', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper = mountWithContexts(
|
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 () => {
|
test('initially renders expected fields and values with existing schedule that runs every year on the May 6', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper = mountWithContexts(
|
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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ function OrganizationDetail({ organization }) {
|
|||||||
value={
|
value={
|
||||||
<ChipGroup numChips={5} totalChips={instanceGroups.length}>
|
<ChipGroup numChips={5} totalChips={instanceGroups.length}>
|
||||||
{instanceGroups.map(ig => (
|
{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>
|
<Chip key={ig.id} isReadOnly>
|
||||||
{ig.name}
|
{ig.name}
|
||||||
</Chip>
|
</Chip>
|
||||||
|
|||||||
@@ -39,7 +39,9 @@ describe('<OrganizationEdit />', () => {
|
|||||||
description: 'new description',
|
description: 'new description',
|
||||||
default_environment: null,
|
default_environment: null,
|
||||||
};
|
};
|
||||||
wrapper.find('OrganizationForm').prop('onSubmit')(updatedOrgData, [], []);
|
await act(async () => {
|
||||||
|
wrapper.find('OrganizationForm').prop('onSubmit')(updatedOrgData, [], []);
|
||||||
|
});
|
||||||
|
|
||||||
expect(OrganizationsAPI.update).toHaveBeenCalledWith(1, updatedOrgData);
|
expect(OrganizationsAPI.update).toHaveBeenCalledWith(1, updatedOrgData);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user