Skip to content
Prev Previous commit
Next Next commit
refactor: TTL-887 improve tests
  • Loading branch information
Santiago220991 committed May 31, 2023
commit 0dfddd2a33950a1dea5d2a4e85b8a59d0049111d
Original file line number Diff line number Diff line change
Expand Up @@ -744,14 +744,13 @@ describe('DetailsFieldsComponent', () => {

component.onSubmit();
expect(toastrServiceStub.warning).not.toHaveBeenCalled();

expect(component.saveEntry.emit).toHaveBeenCalled();
});

it('should not display a warning message when trying to save time entry of external customer without required fields and save', () => {
component.entryForm.setValue({ ...entryWithoutRequiredFields, project_name: 'Warby Parker' });
spyOn(toastrServiceStub, 'warning');
spyOn(component.saveEntry, 'emit');
spyOn(toastrServiceStub, 'warning');

component.onSubmit();
expect(toastrServiceStub.warning).not.toHaveBeenCalled();
Expand All @@ -761,20 +760,17 @@ describe('DetailsFieldsComponent', () => {

it('should not display a warning message when trying to save time entry of internal app with description and save', () => {
component.entryForm.setValue({ ...entryWithoutRequiredFields, description: 'Description' });

spyOn(toastrServiceStub, 'warning');
spyOn(component.saveEntry, 'emit');
spyOn(toastrServiceStub, 'warning');

component.onSubmit();
expect(toastrServiceStub.warning).not.toHaveBeenCalled();

expect(component.saveEntry.emit).toHaveBeenCalled();
});

/* We allow saving time entries with empty fields in uri and description for safari books and english lessons */
it('should not display a warning message when trying to save time entry of English Lessons without description and save', () => {
component.entryForm.setValue({ ...entryWithoutRequiredFields, project_name: 'ioet inc. - English Lessons' });

spyOn(toastrServiceStub, 'warning');
spyOn(component.saveEntry, 'emit');

Expand All @@ -784,7 +780,6 @@ describe('DetailsFieldsComponent', () => {
expect(component.saveEntry.emit).toHaveBeenCalled();
});


/*
TODO As part of https://github.com/ioet/time-tracker-ui/issues/424 a new parameter was added to the details-field-component,
and now these couple of tests are failing. A solution to this error might be generate a Test Wrapper Component. More details here:
Expand Down