Skip to content

Commit 6dc631f

Browse files
test: TTL-910 fix tests
1 parent 89ddb0a commit 6dc631f

File tree

2 files changed

+6
-34
lines changed

2 files changed

+6
-34
lines changed

src/app/modules/reports/components/time-range-custom/time-range-custom.component.spec.ts

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ describe('TimeRangeCustomComponent', () => {
4040
entriesForReport: [timeEntry],
4141
};
4242

43-
const [userId, projectId, activityId] = ['test-userId', 'test-projectId', 'test-activityId'];
44-
4543
beforeEach(async () => {
4644
await TestBed.configureTestingModule({
4745
imports: [FormsModule, ReactiveFormsModule],
@@ -117,25 +115,13 @@ describe('TimeRangeCustomComponent', () => {
117115
expect(component.onSubmit).toHaveBeenCalled();
118116
});
119117

120-
it('When the ngOnChanges method is called, the onSubmit method is called', () => {
121-
spyOn(component, 'onSubmit');
122-
123-
component.ngOnChanges({
124-
userId: new SimpleChange(null, userId, false),
125-
projectId: new SimpleChange(null, projectId, false),
126-
activityId: new SimpleChange(null, activityId, false),
127-
});
128-
129-
expect(component.onSubmit).toHaveBeenCalled();
130-
});
131-
132118
it('When the ngOnChanges method is the first change, the onSubmit method is not called', () => {
133119
spyOn(component, 'onSubmit');
134120

135121
component.ngOnChanges({
136-
userId: new SimpleChange(null, userId, true),
137-
projectId: new SimpleChange(null, projectId, true),
138-
activityId: new SimpleChange(null, activityId, true),
122+
userId: new SimpleChange(null, 'userId', true),
123+
projectId: new SimpleChange(null, 'projectId', true),
124+
activityId: new SimpleChange(null, 'activityId', true),
139125
});
140126

141127
expect(component.onSubmit).not.toHaveBeenCalled();

src/app/modules/reports/components/time-range-form/time-range.component.spec.ts

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ describe('Reports Page', () => {
4242
entriesForReport: [timeEntry],
4343
};
4444

45-
const [userId, projectId, activityId] = ['test-userId', 'test-projectId', 'test-activityId'];
46-
4745
beforeEach(
4846
waitForAsync(() => {
4947
TestBed.configureTestingModule({
@@ -133,25 +131,13 @@ describe('Reports Page', () => {
133131
expect(component.onSubmit).toHaveBeenCalled();
134132
});
135133

136-
it('When the ngOnChanges method is called, the onSubmit method is called', () => {
137-
spyOn(component, 'onSubmit');
138-
139-
component.ngOnChanges({
140-
userId: new SimpleChange(null, userId, false),
141-
projectId: new SimpleChange(null, projectId, false),
142-
activityId: new SimpleChange(null, activityId, false),
143-
});
144-
145-
expect(component.onSubmit).toHaveBeenCalled();
146-
});
147-
148134
it('When the ngOnChanges method is the first change, the onSubmit method is not called', () => {
149135
spyOn(component, 'onSubmit');
150136

151137
component.ngOnChanges({
152-
userId: new SimpleChange(null, userId, true),
153-
projectId: new SimpleChange(null, projectId, true),
154-
activityId: new SimpleChange(null, activityId, true),
138+
userId: new SimpleChange(null, 'user_id', true),
139+
projectId: new SimpleChange(null, 'project_id', true),
140+
activityId: new SimpleChange(null, 'activity_id', true),
155141
});
156142

157143
expect(component.onSubmit).not.toHaveBeenCalled();

0 commit comments

Comments
 (0)