Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: TT-590 unable to pass ci test
  • Loading branch information
alejandra-ponce committed Mar 17, 2022
commit c959de54e09dc0eda68f4f50aa5f35ecd24c3ad0
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,22 @@ describe('EntryFieldsComponent', () => {
});

it('displays error message when the date selected is in the future', () => {
const startMoment = moment();
if (startMoment.format('HH') === '23') {
return; // form logic does not handle day overlap
}
const mockEntry = {
...entry,
start_date: moment().format(DATE_FORMAT_YEAR),
start_hour: moment().format('HH:mm')
start_date: startMoment.format(DATE_FORMAT_YEAR),
start_hour: startMoment.format('HH:mm')
};

component.newData = mockEntry;
component.activeEntry = mockEntry;
component.setDataToUpdate(mockEntry);
spyOn(toastrServiceStub, 'error');

const hourInTheFuture = moment().add(1, 'hours').format('HH:mm');
const hourInTheFuture = startMoment.add(1, 'hours').format('HH:mm');
component.entryForm.patchValue({ start_hour: hourInTheFuture });
component.onUpdateStartHour();

Expand Down Expand Up @@ -233,16 +237,20 @@ describe('EntryFieldsComponent', () => {
});

it('If start hour is in the future, reset to initial start_date in form', () => {
const startMoment = moment();
if (startMoment.format('HH') === '23') {
return; // form logic does not handle day overlap
}
const mockEntry = {
...entry,
start_date: moment().format(DATE_FORMAT_YEAR),
start_hour: moment().format('HH:mm')
start_date: startMoment.format(DATE_FORMAT_YEAR),
start_hour: startMoment.format('HH:mm')
};
component.newData = mockEntry;
component.activeEntry = mockEntry;
component.setDataToUpdate(mockEntry);

const hourInTheFuture = moment().add(1, 'hours').format('HH:mm');
const hourInTheFuture = startMoment.add(1, 'hours').format('HH:mm');
component.entryForm.patchValue({ start_hour: hourInTheFuture });

spyOn(component.entryForm, 'patchValue');
Expand Down