Skip to content

Commit 590c5dd

Browse files
test: TTL-910 fix tests
1 parent 5dc8991 commit 590c5dd

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

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

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

43+
const userId = 'test-userId';
44+
const projectId = 'test-projectId';
45+
const activityId = 'test-activityId';
46+
4347
beforeEach(async () => {
4448
await TestBed.configureTestingModule({
4549
imports: [FormsModule, ReactiveFormsModule],
@@ -116,22 +120,18 @@ describe('TimeRangeCustomComponent', () => {
116120
});
117121

118122
it('When the ngOnChanges method is called, the onSubmit method is called', () => {
119-
const userIdCalled = 'test-user-1';
120-
const projectIdCalled = 'test-project_id';
121-
const activityIdCalled = 'test-activity_id';
122123
spyOn(component, 'onSubmit');
123124

124125
component.ngOnChanges({
125-
userId: new SimpleChange(null, userIdCalled, false),
126-
projectId: new SimpleChange(null, projectIdCalled, false),
127-
activityId: new SimpleChange(null, activityIdCalled, false),
126+
userId: new SimpleChange(null, userId, false),
127+
projectId: new SimpleChange(null, projectId, false),
128+
activityId: new SimpleChange(null, activityId, false),
128129
});
129130

130131
expect(component.onSubmit).toHaveBeenCalled();
131132
});
132133

133134
it('When the ngOnChanges method is the first change, the onSubmit method is not called', () => {
134-
const [userId, projectId, activityId] = ['user-2', 'project_id', 'activity_id'];
135135
spyOn(component, 'onSubmit');
136136

137137
component.ngOnChanges({

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

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

45+
const userId = 'test-userId';
46+
const projectId = 'test-projectId';
47+
const activityId = 'test-activityId';
48+
4549
beforeEach(
4650
waitForAsync(() => {
4751
TestBed.configureTestingModule({
@@ -131,23 +135,22 @@ describe('Reports Page', () => {
131135
expect(component.onSubmit).toHaveBeenCalled();
132136
});
133137

138+
const userIdCalled = 'test-user-2';
139+
const projectIdCalled = 'test-project';
140+
const activityIdCalled = 'test-activity';
134141
it('When the ngOnChanges method is called, the onSubmit method is called', () => {
135-
const userIdCalled = 'test-user-2';
136-
const projectIdCalled = 'test-project';
137-
const activityIdCalled = 'test-activity';
138142
spyOn(component, 'onSubmit');
139143

140144
component.ngOnChanges({
141-
userId: new SimpleChange(null, userIdCalled, false),
142-
projectId: new SimpleChange(null, projectIdCalled, false),
143-
activityId: new SimpleChange(null, activityIdCalled, false),
145+
userId: new SimpleChange(null, userId, false),
146+
projectId: new SimpleChange(null, projectId, false),
147+
activityId: new SimpleChange(null, activityId, false),
144148
});
145149

146150
expect(component.onSubmit).toHaveBeenCalled();
147151
});
148152

149153
it('When the ngOnChanges method is the first change, the onSubmit method is not called', () => {
150-
const [userId, projectId, activityId] = ['user_id', 'project_id', 'activity_id'];
151154
spyOn(component, 'onSubmit');
152155

153156
component.ngOnChanges({

0 commit comments

Comments
 (0)