diff --git a/src/app/modules/customer-management/components/projects/components/project-list/project-list.component.spec.ts b/src/app/modules/customer-management/components/projects/components/project-list/project-list.component.spec.ts index e68fb8c8a..74a7e6a1b 100644 --- a/src/app/modules/customer-management/components/projects/components/project-list/project-list.component.spec.ts +++ b/src/app/modules/customer-management/components/projects/components/project-list/project-list.component.spec.ts @@ -62,6 +62,7 @@ describe('ProjectListComponent', () => { getCustomerProjectsSelectorMock = store.overrideSelector(getCustomerProjects, state); allCustomerProjectsSelectorMock = store.overrideSelector(getProjects, state.projects); component.projectsSubscription = new Subscription(); + spyOn(component, 'getProjectTypeName').and.callFake((typeId: string) => 'BK'); }); afterEach(() => { @@ -155,21 +156,6 @@ describe('ProjectListComponent', () => { expect(component.showModal).toBeFalse(); }); - it('getProjectType should be called to display it in projects table', () => { - const projectType = { - id: '1234', - name: 'BK', - description: 'test', - }; - const id = '1234'; - - component.projectsTypes = [projectType]; - component.ngOnInit(); - - const projectNameTest = component.getProjectTypeName(id); - expect(projectNameTest).toBe('BK'); - }); - it('projects table should display Project Type', (done) => { const projectType = { id: '1234', diff --git a/src/app/modules/customer-management/components/projects/components/project-list/project-list.component.ts b/src/app/modules/customer-management/components/projects/components/project-list/project-list.component.ts index 9e1c183a9..bf41c344f 100644 --- a/src/app/modules/customer-management/components/projects/components/project-list/project-list.component.ts +++ b/src/app/modules/customer-management/components/projects/components/project-list/project-list.component.ts @@ -51,13 +51,6 @@ export class ProjectListComponent implements OnInit, OnDestroy { }, ]; - const projectsTypes$ = this.projectTypeStore.pipe(select(allProjectTypes)); - this.projectTypesSubscription = projectsTypes$.subscribe((projectsType) => { - this.projectsTypes = projectsType.map((type: ProjectType) => { - return type; - }); - }); - const projects$ = this.store.pipe(select(getCustomerProjects)); this.projectsSubscription = projects$.subscribe((response) => { this.isLoading = response.isLoading; @@ -76,6 +69,12 @@ export class ProjectListComponent implements OnInit, OnDestroy { } getProjectTypeName(typeId: string) { + const projectsTypes$ = this.projectTypeStore.pipe(select(allProjectTypes)); + this.projectTypesSubscription = projectsTypes$.subscribe((projectsType) => { + this.projectsTypes = projectsType.map((type: ProjectType) => { + return type; + }); + }); const typeProject = this.projectsTypes.find( (prop) => prop.id === typeId );