Skip to content

Commit 027b7a2

Browse files
test: TTL-910 add test
1 parent c1f8258 commit 027b7a2

File tree

3 files changed

+70
-2
lines changed

3 files changed

+70
-2
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
2+
import { FormsModule } from '@angular/forms';
3+
4+
import { SearchActivityComponent } from './search-activity.component';
5+
import { NgSelectModule } from '@ng-select/ng-select';
6+
7+
describe('SearchActivityComponent', () => {
8+
let component: SearchActivityComponent;
9+
let fixture: ComponentFixture<SearchActivityComponent>;
10+
11+
beforeEach(waitForAsync(() => {
12+
TestBed.configureTestingModule({
13+
imports: [ FormsModule, NgSelectModule ],
14+
declarations: [ SearchActivityComponent ],
15+
}).compileComponents();
16+
}));
17+
18+
beforeEach(() => {
19+
fixture = TestBed.createComponent(SearchActivityComponent);
20+
component = fixture.componentInstance;
21+
fixture.detectChanges();
22+
});
23+
24+
it('should create', () => {
25+
expect(component).toBeTruthy();
26+
});
27+
28+
it('should emit changedFilterValue event #changeFilterValue', () => {
29+
component.selectedActivity = 'angular';
30+
spyOn(component.selectedActivityId, 'emit');
31+
component.updateActivity();
32+
expect(component.selectedActivityId.emit).toHaveBeenCalled();
33+
});
34+
});
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
2+
import { FormsModule } from '@angular/forms';
3+
4+
import { SearchProjectComponent } from './search-project.component';
5+
import { NgSelectModule } from '@ng-select/ng-select';
6+
7+
describe('SearchActivityComponent', () => {
8+
let component: SearchProjectComponent;
9+
let fixture: ComponentFixture<SearchProjectComponent>;
10+
11+
beforeEach(waitForAsync(() => {
12+
TestBed.configureTestingModule({
13+
imports: [ FormsModule, NgSelectModule ],
14+
declarations: [ SearchProjectComponent ],
15+
}).compileComponents();
16+
}));
17+
18+
beforeEach(() => {
19+
fixture = TestBed.createComponent(SearchProjectComponent);
20+
component = fixture.componentInstance;
21+
fixture.detectChanges();
22+
});
23+
24+
it('should create', () => {
25+
expect(component).toBeTruthy();
26+
});
27+
28+
it('should emit changedFilterValue event #changeFilterValue', () => {
29+
component.selectedProject = 'angular';
30+
spyOn(component.selectedProjectId, 'emit');
31+
component.updateProject();
32+
expect(component.selectedProjectId.emit).toHaveBeenCalled();
33+
});
34+
});

src/app/modules/time-clock/services/entry.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ export class EntryService {
8080
loadEntriesByTimeRange(
8181
range: TimeEntriesTimeRange,
8282
userId: string[] | string,
83-
projectId: string,
84-
activityId: string
83+
projectId?: string,
84+
activityId?: string
8585
): Observable<any> {
8686
const MAX_NUMBER_OF_ENTRIES_FOR_REPORTS = 9999;
8787
const loadEntriesByTimeRangeURL = this.urlInProductionLegacy ? this.baseUrl : this.baseUrl + '/report/';

0 commit comments

Comments
 (0)