Skip to content

Commit d1f7f23

Browse files
authored
Fix a failing JS test (#354)
1 parent 6ee8f0d commit d1f7f23

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

awx/ui/src/components/Schedule/shared/ScheduleForm.test.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -902,13 +902,16 @@ describe('<ScheduleForm />', () => {
902902
});
903903

904904
test('should create schedule with the same start and end date provided that the end date is at a later time', async () => {
905-
const today = DateTime.now().toFormat('yyyy-LL-dd');
906-
const laterTime = DateTime.now().plus({ hours: 1 }).toFormat('h:mm a');
905+
const startDate = wrapper.find('DatePicker[aria-label="Start date"]').prop('value');
906+
const startTime = wrapper.find('TimePicker[aria-label="Start time"]').prop('time');
907+
const laterTime = DateTime.fromFormat(startTime, 'h:mm a')
908+
.plus({ minutes: 1 })
909+
.toFormat('h:mm a');
907910
await act(async () => {
908911
wrapper.find('DatePicker[aria-label="End date"]').prop('onChange')(
909912
null,
910-
today,
911-
new Date(today)
913+
startDate,
914+
DateTime.fromFormat(startDate, 'yyyy-LL-dd').toJSDate()
912915
);
913916
});
914917
wrapper.update();

0 commit comments

Comments
 (0)