Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
fix: TT-117 creating new test
  • Loading branch information
scastillo-jp committed Jan 29, 2021
commit cbf454cd65415cd4879ad4102fd8f0c77354a20e
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ describe('DetailsFieldsComponent', () => {
},
shouldRestartEntry: false
};
expect(component.shouldRestartEntry).toBeFalse();

expect(component.saveEntry.emit).toHaveBeenCalledWith(data);
});

Expand Down Expand Up @@ -300,6 +300,23 @@ describe('DetailsFieldsComponent', () => {
fixture.componentInstance.ngOnChanges();

expect(component.goingToWorkOnThis).toBeFalse();
expect(component.shouldRestartEntry).toBeFalse();
});

it('when editing entry is running, shouldRestartEntry should be false', () => {
component.entryToEdit = { ...entryToEdit, running: true };

fixture.componentInstance.ngOnChanges();

expect(component.goingToWorkOnThis).toBeTrue();
expect(component.shouldRestartEntry).toBeFalse();
});

it('when editing entry change to going to work on this shouldRestartEntry should be true', () => {
component.onGoingToWorkOnThisChange({ currentTarget: { checked: true } });

expect(component.goingToWorkOnThis).toBeTrue();
expect(component.shouldRestartEntry).toBeTrue();
});

it('when submitting a entry that is currently running, the end date should not be sent ', () => {
Expand All @@ -322,7 +339,7 @@ describe('DetailsFieldsComponent', () => {
},
shouldRestartEntry: false
};
expect(component.shouldRestartEntry).toBeFalse();

expect(component.saveEntry.emit).toHaveBeenCalledWith(data);
});

Expand Down