From a0e2760a732a7af7ef15d5275bdd71e61d9943c7 Mon Sep 17 00:00:00 2001 From: Duncan Carter Date: Tue, 2 Jul 2024 17:35:19 +0100 Subject: [PATCH 01/13] Use route data instead of setting in service for showing CQC banner --- .../cqcStatusCheck/cqcStatusCheck.resolver.ts | 7 +----- .../workplace-tab.component.spec.ts | 24 +++++++++++++++---- .../workplace-tab/workplace-tab.component.ts | 4 +++- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.ts b/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.ts index 255ac88594..271a46e1eb 100644 --- a/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.ts +++ b/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { ActivatedRouteSnapshot, Resolve } from '@angular/router'; import { EstablishmentService } from '@core/services/establishment.service'; import { of } from 'rxjs'; -import { catchError, tap } from 'rxjs/operators'; +import { catchError } from 'rxjs/operators'; @Injectable() export class CqcStatusCheckResolver implements Resolve { @@ -17,11 +17,6 @@ export class CqcStatusCheckResolver implements Resolve { postcode, mainService: mainService.name, }) - .pipe( - tap(({ cqcStatusMatch }) => { - this.establishmentService.setCheckCQCDetailsBanner(cqcStatusMatch === false); - }), - ) .pipe( catchError(() => { return of(null); diff --git a/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.spec.ts b/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.spec.ts index 05f926597f..42dbb5de10 100644 --- a/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.spec.ts +++ b/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.spec.ts @@ -1,7 +1,7 @@ import { HttpClient } from '@angular/common/http'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { ReactiveFormsModule } from '@angular/forms'; -import { Router, RouterModule } from '@angular/router'; +import { ActivatedRoute, Router, RouterModule } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; import { PermissionType } from '@core/model/permissions.model'; import { Roles } from '@core/model/roles.enum'; @@ -33,6 +33,7 @@ const MockWindow = { }, }, }; + describe('NewWorkplaceTabComponent', () => { const setup = async ( permissions = ['canEditEstablishment'], @@ -60,10 +61,9 @@ describe('NewWorkplaceTabComponent', () => { }, { provide: EstablishmentService, - useFactory: MockEstablishmentServiceCheckCQCDetails.factory(checkCqcDetails), + useFactory: MockEstablishmentServiceCheckCQCDetails.factory(), deps: [HttpClient], }, - { provide: WindowRef, useClass: WindowRef, @@ -79,6 +79,16 @@ describe('NewWorkplaceTabComponent', () => { useFactory: MockAuthService.factory(true, isAdmin), deps: [HttpClient, Router, EstablishmentService, UserService, PermissionsService], }, + { + provide: ActivatedRoute, + useValue: { + snapshot: { + data: { + cqcStatusCheck: { cqcStatusMatch: checkCqcDetails }, + }, + }, + }, + }, { provide: WindowToken, useValue: MockWindow }, ], componentProperties: { @@ -133,12 +143,18 @@ describe('NewWorkplaceTabComponent', () => { expect(queryByText('Start to add more details about your workplace')).toBeFalsy(); }); - it('should show the check cqc details banner when checkCQCDetails is true', async () => { + it('should show the check cqc details banner when checkCQCDetails is true in route data', async () => { const { getByTestId } = await setup(['canEditEstablishment'], true); expect(getByTestId('check-cqc-details-banner')).toBeTruthy(); }); + it('should not show the check cqc details banner when checkCQCDetails is false in route data', async () => { + const { queryByTestId } = await setup(['canEditEstablishment'], false); + + expect(queryByTestId('check-cqc-details-banner')).toBeFalsy(); + }); + it('should not show the check cqc details banner when there are not the correct permissions', async () => { const { queryByTestId } = await setup([], true); diff --git a/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.ts b/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.ts index 2d5f798c7a..fe1e582008 100644 --- a/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.ts +++ b/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.ts @@ -1,4 +1,5 @@ import { Component, Input, OnDestroy, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; import { JourneyType } from '@core/breadcrumb/breadcrumb.model'; import { Establishment } from '@core/model/establishment.model'; import { URLStructure } from '@core/model/url.model'; @@ -27,6 +28,7 @@ export class NewWorkplaceTabComponent implements OnInit, OnDestroy { private permissionsService: PermissionsService, private alertService: AlertService, private tabsService: TabsService, + private route: ActivatedRoute, ) {} ngOnInit(): void { @@ -34,7 +36,7 @@ export class NewWorkplaceTabComponent implements OnInit, OnDestroy { this.breadcrumbService.show(JourneyType.WORKPLACE_TAB); this.canEditEstablishment = this.permissionsService.can(this.workplace?.uid, 'canEditEstablishment'); this.addWorkplaceDetailsBanner = this.workplace.showAddWorkplaceDetailsBanner; - this.showCqcDetailsBanner = this.establishmentService.checkCQCDetailsBanner; + this.showCqcDetailsBanner = this.route.snapshot.data?.cqcStatusCheck?.cqcStatusMatch; } public navigateToTab(event: Event, selectedTab: string): void { From 9dfc5912eaf6988bb50365e773b3535bcde1a441 Mon Sep 17 00:00:00 2001 From: Duncan Carter Date: Tue, 2 Jul 2024 17:38:43 +0100 Subject: [PATCH 02/13] Remove unneeded activated route and add return type to resolver --- .../cqcStatusCheck/cqcStatusCheck.resolver.spec.ts | 8 +++----- .../cqcStatusCheck/cqcStatusCheck.resolver.ts | 10 +++++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.spec.ts b/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.spec.ts index 0dbe15fcb7..5f5c1d0ace 100644 --- a/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.spec.ts +++ b/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.spec.ts @@ -1,6 +1,5 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { TestBed } from '@angular/core/testing'; -import { ActivatedRoute } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; import { EstablishmentService } from '@core/services/establishment.service'; import { MockEstablishmentService } from '@core/test-utils/MockEstablishmentService'; @@ -20,11 +19,10 @@ describe('CqcStatusCheckResolver', () => { ], }); const resolver = TestBed.inject(CqcStatusCheckResolver); - const route = TestBed.inject(ActivatedRoute); const establishmentService = TestBed.inject(EstablishmentService); - return { resolver, route, establishmentService }; + return { resolver, establishmentService }; }; it('should be created', async () => { @@ -33,9 +31,9 @@ describe('CqcStatusCheckResolver', () => { }); it('should call getCQCRegistrationStatus', async () => { - const { resolver, route, establishmentService } = await setup(); + const { resolver, establishmentService } = await setup(); const getCqcRegistrationStatusSpy = spyOn(establishmentService, 'getCQCRegistrationStatus').and.callThrough(); - resolver.resolve(route.snapshot); + resolver.resolve(); expect(getCqcRegistrationStatusSpy).toHaveBeenCalledWith('1-11111111', { postcode: 'AB1 2CD', diff --git a/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.ts b/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.ts index 271a46e1eb..8150932453 100644 --- a/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.ts +++ b/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.ts @@ -1,14 +1,18 @@ import { Injectable } from '@angular/core'; -import { ActivatedRouteSnapshot, Resolve } from '@angular/router'; +import { Resolve } from '@angular/router'; import { EstablishmentService } from '@core/services/establishment.service'; -import { of } from 'rxjs'; +import { Observable, of } from 'rxjs'; import { catchError } from 'rxjs/operators'; +export class CQCRegistrationStatusResponse { + cqcStatusMatch: boolean; +} + @Injectable() export class CqcStatusCheckResolver implements Resolve { constructor(private establishmentService: EstablishmentService) {} - resolve(route: ActivatedRouteSnapshot) { + resolve(): Observable { const { locationId, postcode, mainService } = this.establishmentService.primaryWorkplace; if (locationId) { From eb5e804a6cbf007937cddb49d04086aa629642ec Mon Sep 17 00:00:00 2001 From: Duncan Carter Date: Tue, 2 Jul 2024 18:20:58 +0100 Subject: [PATCH 03/13] Update resolver to use establishment instead of primary workplace --- .../cqcStatusCheck/cqcStatusCheck.resolver.spec.ts | 14 +++++++++++--- .../cqcStatusCheck/cqcStatusCheck.resolver.ts | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.spec.ts b/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.spec.ts index 5f5c1d0ace..32af7b5c2f 100644 --- a/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.spec.ts +++ b/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.spec.ts @@ -1,6 +1,7 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; +import { Establishment } from '@core/model/establishment.model'; import { EstablishmentService } from '@core/services/establishment.service'; import { MockEstablishmentService } from '@core/test-utils/MockEstablishmentService'; @@ -32,12 +33,19 @@ describe('CqcStatusCheckResolver', () => { it('should call getCQCRegistrationStatus', async () => { const { resolver, establishmentService } = await setup(); + const establishment = { + locationId: '1-11111111', + postcode: 'ABC123', + mainService: { name: 'Care' }, + } as Establishment; + + spyOnProperty(establishmentService, 'establishment').and.returnValue(establishment); const getCqcRegistrationStatusSpy = spyOn(establishmentService, 'getCQCRegistrationStatus').and.callThrough(); resolver.resolve(); - expect(getCqcRegistrationStatusSpy).toHaveBeenCalledWith('1-11111111', { - postcode: 'AB1 2CD', - mainService: 'Care', + expect(getCqcRegistrationStatusSpy).toHaveBeenCalledWith(establishment.locationId, { + postcode: establishment.postcode, + mainService: establishment.mainService.name, }); }); }); diff --git a/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.ts b/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.ts index 8150932453..e8467ba4b9 100644 --- a/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.ts +++ b/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.ts @@ -13,7 +13,7 @@ export class CqcStatusCheckResolver implements Resolve { constructor(private establishmentService: EstablishmentService) {} resolve(): Observable { - const { locationId, postcode, mainService } = this.establishmentService.primaryWorkplace; + const { locationId, postcode, mainService } = this.establishmentService.establishment; if (locationId) { return this.establishmentService From 83614aa564184ca357b61d6ce20af26f66a75cb6 Mon Sep 17 00:00:00 2001 From: Duncan Carter Date: Tue, 2 Jul 2024 18:22:15 +0100 Subject: [PATCH 04/13] Add setting of showCqcDetailsBanner to sub workplace page --- .../app/features/subsidiary/subsidiary-routing.module.ts | 6 +++++- .../workplace/view-subsidiary-workplace.component.ts | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/features/subsidiary/subsidiary-routing.module.ts b/frontend/src/app/features/subsidiary/subsidiary-routing.module.ts index 9ead6873af..30f2713906 100644 --- a/frontend/src/app/features/subsidiary/subsidiary-routing.module.ts +++ b/frontend/src/app/features/subsidiary/subsidiary-routing.module.ts @@ -7,6 +7,7 @@ import { CheckPermissionsGuard } from '@core/guards/permissions/check-permission import { HasPermissionsGuard } from '@core/guards/permissions/has-permissions/has-permissions.guard'; import { ArticleListResolver } from '@core/resolvers/article-list.resolver'; import { BenchmarksResolver } from '@core/resolvers/benchmarks.resolver'; +import { CqcStatusCheckResolver } from '@core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver'; import { AllUsersForEstablishmentResolver } from '@core/resolvers/dashboard/all-users-for-establishment.resolver'; import { TotalStaffRecordsResolver } from '@core/resolvers/dashboard/total-staff-records.resolver'; import { ExpiresSoonAlertDatesResolver } from '@core/resolvers/expiresSoonAlertDates.resolver'; @@ -21,6 +22,7 @@ import { WorkersResolver } from '@core/resolvers/workers.resolver'; import { WorkplaceResolver } from '@core/resolvers/workplace.resolver'; import { AscWdsCertificateComponent } from '@features/dashboard/asc-wds-certificate/asc-wds-certificate.component'; import { FirstLoginPageComponent } from '@features/first-login-page/first-login-page.component'; +import { DeleteWorkplaceComponent } from '@features/new-dashboard/delete-workplace/delete-workplace.component'; import { StaffBasicRecord } from '@features/new-dashboard/staff-tab/staff-basic-record/staff-basic-record.component'; import { AcceptPreviousCareCertificateComponent } from '@features/workplace/accept-previous-care-certificate/accept-previous-care-certificate.component'; import { BenefitsStatutorySickPayComponent } from '@features/workplace/benefits-statutory-sick-pay/benefits-statutory-sick-pay.component'; @@ -67,7 +69,6 @@ import { ViewSubsidiaryStaffRecordsComponent } from './staff-records/view-subsid import { ViewSubsidiaryTrainingAndQualificationsComponent } from './training-and-qualifications/view-subsidiary-training-and-qualifications.component'; import { ViewSubsidiaryWorkplaceUsersComponent } from './workplace-users/view-subsidiary-workplace-users.component'; import { ViewSubsidiaryWorkplaceComponent } from './workplace/view-subsidiary-workplace.component'; -import { DeleteWorkplaceComponent } from '@features/new-dashboard/delete-workplace/delete-workplace.component'; // eslint-disable-next-line max-len const routes: Routes = [ @@ -162,6 +163,9 @@ const routes: Routes = [ path: 'workplace', component: ViewSubsidiaryWorkplaceComponent, data: { title: 'Workplace' }, + resolve: { + cqcStatusCheck: CqcStatusCheckResolver, + }, }, { path: 'delete-workplace', diff --git a/frontend/src/app/features/subsidiary/workplace/view-subsidiary-workplace.component.ts b/frontend/src/app/features/subsidiary/workplace/view-subsidiary-workplace.component.ts index b26b5d2129..8c799f344f 100644 --- a/frontend/src/app/features/subsidiary/workplace/view-subsidiary-workplace.component.ts +++ b/frontend/src/app/features/subsidiary/workplace/view-subsidiary-workplace.component.ts @@ -36,6 +36,7 @@ export class ViewSubsidiaryWorkplaceComponent implements OnInit { this.workplace = this.route.snapshot.data.establishment; this.workerCount = this.route.snapshot.data.workers?.workerCount; this.addWorkplaceDetailsBanner = this.workplace.showAddWorkplaceDetailsBanner; + this.showCqcDetailsBanner = this.route.snapshot.data?.cqcStatusCheck?.cqcStatusMatch; this.canEditEstablishment = this.permissionsService.can(this.workplace?.uid, 'canEditEstablishment'); } From 8d2425e898146618f441bea2e8c19234c50bf83a Mon Sep 17 00:00:00 2001 From: Duncan Carter Date: Wed, 3 Jul 2024 09:39:04 +0100 Subject: [PATCH 05/13] Use data returned from resolver directly to set CQC message on summary panel across home pages --- .../home-tab/home-tab.component.html | 1 + .../home-tab/home-tab.component.spec.ts | 22 +++++++++++-------- .../parent-home-tab.component.html | 1 + .../parent-home-tab.component.spec.ts | 22 ++++++++++++++----- .../home/view-subsidiary-home.component.html | 1 + .../view-subsidiary-home.component.spec.ts | 10 ++++----- .../home/view-subsidiary-home.component.ts | 3 ++- .../subsidiary/subsidiary-routing.module.ts | 4 +--- .../summary-section.component.spec.ts | 7 +++--- .../summary-section.component.ts | 3 ++- .../new-home-tab/new-home-tab.directive.ts | 2 ++ 11 files changed, 47 insertions(+), 29 deletions(-) diff --git a/frontend/src/app/features/new-dashboard/home-tab/home-tab.component.html b/frontend/src/app/features/new-dashboard/home-tab/home-tab.component.html index a3fbbffaec..609f92be1d 100644 --- a/frontend/src/app/features/new-dashboard/home-tab/home-tab.component.html +++ b/frontend/src/app/features/new-dashboard/home-tab/home-tab.component.html @@ -12,6 +12,7 @@ [workersNotCompleted]="workersNotCompleted" [(navigateToTab)]="navigateToTab" [canViewEstablishment]="canViewEstablishment" + [showCheckCqcDetails]="showCheckCqcDetails" >
diff --git a/frontend/src/app/features/new-dashboard/home-tab/home-tab.component.spec.ts b/frontend/src/app/features/new-dashboard/home-tab/home-tab.component.spec.ts index 5fc6699a66..6fb10b00e6 100644 --- a/frontend/src/app/features/new-dashboard/home-tab/home-tab.component.spec.ts +++ b/frontend/src/app/features/new-dashboard/home-tab/home-tab.component.spec.ts @@ -16,14 +16,12 @@ import { TabsService } from '@core/services/tabs.service'; import { UserService } from '@core/services/user.service'; import { WindowToken } from '@core/services/window'; import { WindowRef } from '@core/services/window.ref'; -import { MockEstablishmentServiceCheckCQCDetails } from '@core/test-utils/MockEstablishmentService'; +import { MockEstablishmentService } from '@core/test-utils/MockEstablishmentService'; import { MockFeatureFlagsService } from '@core/test-utils/MockFeatureFlagService'; import { MockPermissionsService } from '@core/test-utils/MockPermissionsService'; import { MockUserService } from '@core/test-utils/MockUserService'; import { NewArticleListComponent } from '@features/articles/new-article-list/new-article-list.component'; -import { - OwnershipChangeMessageDialogComponent, -} from '@shared/components/ownership-change-message/ownership-change-message-dialog.component'; +import { OwnershipChangeMessageDialogComponent } from '@shared/components/ownership-change-message/ownership-change-message-dialog.component'; import { SummarySectionComponent } from '@shared/components/summary-section/summary-section.component'; import { FeatureFlagsService } from '@shared/services/feature-flags.service'; import { SharedModule } from '@shared/shared.module'; @@ -44,7 +42,7 @@ const MockWindow = { describe('NewHomeTabComponent', () => { const setup = async ( - checkCqcDetails = false, + cqcStatusMatch = true, establishment = Establishment, comparisonDataAvailable = true, noOfWorkplaces = 9, @@ -82,6 +80,7 @@ describe('NewHomeTabComponent', () => { trainingCounts: {} as TrainingCounts, workersNotCompleted: [], }, + cqcStatusCheck: { cqcStatusMatch }, }, }, queryParams: of({ view: null }), @@ -90,8 +89,7 @@ describe('NewHomeTabComponent', () => { }, { provide: EstablishmentService, - useFactory: MockEstablishmentServiceCheckCQCDetails.factory(checkCqcDetails), - deps: [HttpClient], + useClass: MockEstablishmentService, }, { provide: WindowToken, useValue: MockWindow }, ], @@ -907,9 +905,9 @@ describe('NewHomeTabComponent', () => { expect(tabsServiceSpy).toHaveBeenCalledWith('workplace'); }); - it('should show a warning link which should navigate to the workplace tab', async () => { + it('should show a warning link which should navigate to the workplace tab when showAddWorkplaceDetailsBanner is true', async () => { const establishment = { ...Establishment, showAddWorkplaceDetailsBanner: true }; - const { getByText, tabsServiceSpy } = await setup(true, establishment); + const { getByText, tabsServiceSpy } = await setup(false, establishment); const link = getByText('Add more details to your workplace'); @@ -917,6 +915,12 @@ describe('NewHomeTabComponent', () => { fireEvent.click(link); expect(tabsServiceSpy).toHaveBeenCalledWith('workplace'); }); + + it('should show a CQC message when showAddWorkplaceDetailsBanner is false and cqcStatusMatch is false', async () => { + const { getByText } = await setup(false); + + expect(getByText('You need to check your CQC details')).toBeTruthy(); + }); }); describe('staff records summary section', () => { diff --git a/frontend/src/app/features/new-dashboard/parent-home-tab/parent-home-tab.component.html b/frontend/src/app/features/new-dashboard/parent-home-tab/parent-home-tab.component.html index 6cc3fa45b3..ee0d87de96 100644 --- a/frontend/src/app/features/new-dashboard/parent-home-tab/parent-home-tab.component.html +++ b/frontend/src/app/features/new-dashboard/parent-home-tab/parent-home-tab.component.html @@ -21,6 +21,7 @@ [canViewEstablishment]="canViewEstablishment" [showMissingCqcMessage]="showMissingCqcMessage" [workplacesCount]="workplacesCount" + [showCheckCqcDetails]="showCheckCqcDetails" >
diff --git a/frontend/src/app/features/new-dashboard/parent-home-tab/parent-home-tab.component.spec.ts b/frontend/src/app/features/new-dashboard/parent-home-tab/parent-home-tab.component.spec.ts index a6b63f415b..77d773827c 100644 --- a/frontend/src/app/features/new-dashboard/parent-home-tab/parent-home-tab.component.spec.ts +++ b/frontend/src/app/features/new-dashboard/parent-home-tab/parent-home-tab.component.spec.ts @@ -17,7 +17,7 @@ import { UserService } from '@core/services/user.service'; import { WindowToken } from '@core/services/window'; import { WindowRef } from '@core/services/window.ref'; import { MockArticlesService } from '@core/test-utils/MockArticlesService'; -import { MockEstablishmentServiceCheckCQCDetails } from '@core/test-utils/MockEstablishmentService'; +import { MockEstablishmentService } from '@core/test-utils/MockEstablishmentService'; import { MockFeatureFlagsService } from '@core/test-utils/MockFeatureFlagService'; import { MockPermissionsService } from '@core/test-utils/MockPermissionsService'; import { MockUserService } from '@core/test-utils/MockUserService'; @@ -45,7 +45,7 @@ describe('ParentHomeTabComponent', () => { const articles = MockArticlesService.articlesFactory(); const setup = async ( - checkCqcDetails = false, + cqcStatusMatch = true, establishment = Establishment, comparisonDataAvailable = true, noOfWorkplaces = 9, @@ -83,6 +83,7 @@ describe('ParentHomeTabComponent', () => { trainingCounts: {} as TrainingCounts, workersNotCompleted: [], }, + cqcStatusCheck: { cqcStatusMatch }, }, }, queryParams: of({ view: null }), @@ -91,8 +92,7 @@ describe('ParentHomeTabComponent', () => { }, { provide: EstablishmentService, - useFactory: MockEstablishmentServiceCheckCQCDetails.factory(checkCqcDetails), - deps: [HttpClient], + useClass: MockEstablishmentService, }, { provide: ArticlesService, useClass: MockArticlesService }, { provide: WindowToken, useValue: MockWindow }, @@ -104,7 +104,7 @@ describe('ParentHomeTabComponent', () => { ? { workplaces: noOfWorkplaces, staff: 4, localAuthority: 'Test LA' } : ({ workplaces: 0, staff: 0, localAuthority: 'Test LA' } as Meta), canRunLocalAuthorityReport: false, - article: {slug: ''} + article: { slug: '' }, }, schemas: [NO_ERRORS_SCHEMA], }, @@ -332,7 +332,7 @@ describe('ParentHomeTabComponent', () => { it('should show a warning link which should navigate to the workplace tab', async () => { const establishment = { ...Establishment, showAddWorkplaceDetailsBanner: true }; - const { component, fixture, getByText, tabsServiceSpy } = await setup(true, establishment); + const { component, fixture, getByText, tabsServiceSpy } = await setup(false, establishment); component.canViewListOfWorkers = true; component.canViewEstablishment = true; @@ -344,6 +344,16 @@ describe('ParentHomeTabComponent', () => { expect(link).toBeTruthy(); expect(tabsServiceSpy).toHaveBeenCalledWith('workplace'); }); + + it('should show a CQC message when showAddWorkplaceDetailsBanner is false and cqcStatusMatch is false', async () => { + const { component, fixture, getByText } = await setup(false); + + component.canViewListOfWorkers = true; + component.canViewEstablishment = true; + fixture.detectChanges(); + + expect(getByText('You need to check your CQC details')).toBeTruthy(); + }); }); describe('staff records summary section', () => { diff --git a/frontend/src/app/features/subsidiary/home/view-subsidiary-home.component.html b/frontend/src/app/features/subsidiary/home/view-subsidiary-home.component.html index 629069daf4..435f042559 100644 --- a/frontend/src/app/features/subsidiary/home/view-subsidiary-home.component.html +++ b/frontend/src/app/features/subsidiary/home/view-subsidiary-home.component.html @@ -16,6 +16,7 @@ [(navigateToTab)]="navigateToTab" [canViewEstablishment]="canViewEstablishment" [isParentSubsidiaryView]="true" + [showCheckCqcDetails]="showCheckCqcDetails" >
diff --git a/frontend/src/app/features/subsidiary/home/view-subsidiary-home.component.spec.ts b/frontend/src/app/features/subsidiary/home/view-subsidiary-home.component.spec.ts index 14cb275bf8..f09ea13648 100644 --- a/frontend/src/app/features/subsidiary/home/view-subsidiary-home.component.spec.ts +++ b/frontend/src/app/features/subsidiary/home/view-subsidiary-home.component.spec.ts @@ -15,7 +15,7 @@ import { TabsService } from '@core/services/tabs.service'; import { UserService } from '@core/services/user.service'; import { WindowToken } from '@core/services/window'; import { WindowRef } from '@core/services/window.ref'; -import { MockEstablishmentServiceCheckCQCDetails } from '@core/test-utils/MockEstablishmentService'; +import { MockEstablishmentService } from '@core/test-utils/MockEstablishmentService'; import { MockFeatureFlagsService } from '@core/test-utils/MockFeatureFlagService'; import { MockPermissionsService } from '@core/test-utils/MockPermissionsService'; import { MockUserService } from '@core/test-utils/MockUserService'; @@ -40,7 +40,7 @@ const MockWindow = { describe('ViewSubsidiaryHomeComponent', () => { const setup = async ( - checkCqcDetails = false, + cqcStatusMatch = true, establishment = Establishment, comparisonDataAvailable = true, noOfWorkplaces = 9, @@ -89,6 +89,7 @@ describe('ViewSubsidiaryHomeComponent', () => { trainingCounts: {} as TrainingCounts, workersNotCompleted: [], }, + cqcStatusCheck: { cqcStatusMatch }, }, }, queryParams: of({ view: null }), @@ -97,8 +98,7 @@ describe('ViewSubsidiaryHomeComponent', () => { }, { provide: EstablishmentService, - useFactory: MockEstablishmentServiceCheckCQCDetails.factory(checkCqcDetails), - deps: [HttpClient], + useClass: MockEstablishmentService, }, { provide: WindowToken, useValue: MockWindow }, ], @@ -350,7 +350,7 @@ describe('ViewSubsidiaryHomeComponent', () => { it('should show a warning link which should navigate to the workplace tab', async () => { const establishment = { ...Establishment, showAddWorkplaceDetailsBanner: true }; - const { getByText, tabsServiceSpy } = await setup(true, establishment); + const { getByText, tabsServiceSpy } = await setup(false, establishment); const link = getByText('Add more details to your workplace'); diff --git a/frontend/src/app/features/subsidiary/home/view-subsidiary-home.component.ts b/frontend/src/app/features/subsidiary/home/view-subsidiary-home.component.ts index c078973048..ece1691d71 100644 --- a/frontend/src/app/features/subsidiary/home/view-subsidiary-home.component.ts +++ b/frontend/src/app/features/subsidiary/home/view-subsidiary-home.component.ts @@ -64,6 +64,7 @@ export class ViewSubsidiaryHomeComponent implements OnInit { public locationId: string; public workplacesCount: number; public tilesData: BenchmarksResponse; + public showCheckCqcDetails: boolean; constructor( private userService: UserService, @@ -82,7 +83,7 @@ export class ViewSubsidiaryHomeComponent implements OnInit { this.workerCount = this.route.snapshot.data.workers?.workerCount; this.trainingCounts = this.route.snapshot.data.workers?.trainingCounts; this.workersNotCompleted = this.route.snapshot.data.workers?.workersNotCompleted; - + this.showCheckCqcDetails = this.route.snapshot.data?.cqcStatusCheck?.cqcStatusMatch === false; this.user = this.userService.loggedInUser; this.addWorkplaceDetailsBanner = this.subsidiaryWorkplace.showAddWorkplaceDetailsBanner; this.setPermissionLinks(); diff --git a/frontend/src/app/features/subsidiary/subsidiary-routing.module.ts b/frontend/src/app/features/subsidiary/subsidiary-routing.module.ts index 30f2713906..5deaa24ddb 100644 --- a/frontend/src/app/features/subsidiary/subsidiary-routing.module.ts +++ b/frontend/src/app/features/subsidiary/subsidiary-routing.module.ts @@ -121,6 +121,7 @@ const routes: Routes = [ rankingsResolver: RankingsResolver, usefulLinksPay: UsefulLinkPayResolver, usefulLinkRecruitment: UsefulLinkRecruitmentResolver, + cqcStatusCheck: CqcStatusCheckResolver, }, children: [ { @@ -163,9 +164,6 @@ const routes: Routes = [ path: 'workplace', component: ViewSubsidiaryWorkplaceComponent, data: { title: 'Workplace' }, - resolve: { - cqcStatusCheck: CqcStatusCheckResolver, - }, }, { path: 'delete-workplace', diff --git a/frontend/src/app/shared/components/summary-section/summary-section.component.spec.ts b/frontend/src/app/shared/components/summary-section/summary-section.component.spec.ts index 95b6ea9bbf..84bab279b4 100644 --- a/frontend/src/app/shared/components/summary-section/summary-section.component.spec.ts +++ b/frontend/src/app/shared/components/summary-section/summary-section.component.spec.ts @@ -1,4 +1,3 @@ -import { HttpClient } from '@angular/common/http'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { getTestBed } from '@angular/core/testing'; import { Router, RouterModule } from '@angular/router'; @@ -7,7 +6,7 @@ import { TrainingCounts } from '@core/model/trainingAndQualifications.model'; import { Worker } from '@core/model/worker.model'; import { EstablishmentService } from '@core/services/establishment.service'; import { TabsService } from '@core/services/tabs.service'; -import { MockEstablishmentServiceCheckCQCDetails } from '@core/test-utils/MockEstablishmentService'; +import { MockEstablishmentService } from '@core/test-utils/MockEstablishmentService'; import { MockTabsService } from '@core/test-utils/MockTabsService'; import { workerBuilder } from '@core/test-utils/MockWorkerService'; import { SharedModule } from '@shared/shared.module'; @@ -38,8 +37,7 @@ describe('Summary section', () => { }, { provide: EstablishmentService, - useFactory: MockEstablishmentServiceCheckCQCDetails.factory(checkCqcDetails), - deps: [HttpClient], + useClass: MockEstablishmentService, }, ], componentProperties: { @@ -57,6 +55,7 @@ describe('Summary section', () => { showMissingCqcMessage: false, workplacesCount: 0, isParentSubsidiaryView, + showCheckCqcDetails: checkCqcDetails, }, }); diff --git a/frontend/src/app/shared/components/summary-section/summary-section.component.ts b/frontend/src/app/shared/components/summary-section/summary-section.component.ts index a9e83c39ad..1ac2f4b018 100644 --- a/frontend/src/app/shared/components/summary-section/summary-section.component.ts +++ b/frontend/src/app/shared/components/summary-section/summary-section.component.ts @@ -24,6 +24,7 @@ export class SummarySectionComponent implements OnInit, OnChanges { @Input() showMissingCqcMessage: boolean; @Input() workplacesCount: number; @Input() isParentSubsidiaryView: boolean; + @Input() showCheckCqcDetails: boolean; public sections = [ { linkText: 'Workplace', fragment: 'workplace', message: '', route: undefined, redFlag: false, link: true }, @@ -86,7 +87,7 @@ export class SummarySectionComponent implements OnInit, OnChanges { this.sections[0].redFlag = false; if (showAddWorkplaceDetailsBanner) { this.sections[0].message = 'Add more details to your workplace'; - } else if (this.establishmentService.checkCQCDetailsBanner) { + } else if (this.showCheckCqcDetails) { this.sections[0].message = 'You need to check your CQC details'; } else if (!numberOfStaff) { this.sections[0].message = `You've not added your total number of staff`; diff --git a/frontend/src/app/shared/directives/new-home-tab/new-home-tab.directive.ts b/frontend/src/app/shared/directives/new-home-tab/new-home-tab.directive.ts index 17aa6b40b8..bd3f514796 100644 --- a/frontend/src/app/shared/directives/new-home-tab/new-home-tab.directive.ts +++ b/frontend/src/app/shared/directives/new-home-tab/new-home-tab.directive.ts @@ -84,6 +84,7 @@ export class NewHomeTabDirective implements OnInit, OnDestroy, OnChanges { public workplacesCount: number; public isParentSubsidiaryView: boolean; public article: Article; + public showCheckCqcDetails: boolean; constructor( private userService: UserService, @@ -106,6 +107,7 @@ export class NewHomeTabDirective implements OnInit, OnDestroy, OnChanges { this.workerCount = this.route.snapshot.data.workers?.workerCount; this.trainingCounts = this.route.snapshot.data.workers?.trainingCounts; this.workersNotCompleted = this.route.snapshot.data.workers?.workersNotCompleted; + this.showCheckCqcDetails = this.route.snapshot.data?.cqcStatusCheck?.cqcStatusMatch === false; this.user = this.userService.loggedInUser; this.addWorkplaceDetailsBanner = this.workplace.showAddWorkplaceDetailsBanner; From 748bf4a35ac5f58c77f5faeb0350a03501e09539 Mon Sep 17 00:00:00 2001 From: Duncan Carter Date: Wed, 3 Jul 2024 10:55:00 +0100 Subject: [PATCH 06/13] Update workplace tabs to show CQC banner when cqcStatusMatch is false --- .../workplace-tab.component.spec.ts | 12 +- .../workplace-tab/workplace-tab.component.ts | 2 +- ...iew-subsidiary-workplace.component.spec.ts | 157 ++++++++++++++++++ .../view-subsidiary-workplace.component.ts | 2 +- 4 files changed, 165 insertions(+), 8 deletions(-) create mode 100644 frontend/src/app/features/subsidiary/workplace/view-subsidiary-workplace.component.spec.ts diff --git a/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.spec.ts b/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.spec.ts index 42dbb5de10..dc1d8d86be 100644 --- a/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.spec.ts +++ b/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.spec.ts @@ -37,7 +37,7 @@ const MockWindow = { describe('NewWorkplaceTabComponent', () => { const setup = async ( permissions = ['canEditEstablishment'], - checkCqcDetails = false, + cqcStatusMatch = true, establishment = Establishment, isAdmin = true, subsidiaries = 0, @@ -84,7 +84,7 @@ describe('NewWorkplaceTabComponent', () => { useValue: { snapshot: { data: { - cqcStatusCheck: { cqcStatusMatch: checkCqcDetails }, + cqcStatusCheck: { cqcStatusMatch }, }, }, }, @@ -143,14 +143,14 @@ describe('NewWorkplaceTabComponent', () => { expect(queryByText('Start to add more details about your workplace')).toBeFalsy(); }); - it('should show the check cqc details banner when checkCQCDetails is true in route data', async () => { - const { getByTestId } = await setup(['canEditEstablishment'], true); + it('should show the check cqc details banner when cqcStatusMatch is false in route data', async () => { + const { getByTestId } = await setup(['canEditEstablishment'], false); expect(getByTestId('check-cqc-details-banner')).toBeTruthy(); }); - it('should not show the check cqc details banner when checkCQCDetails is false in route data', async () => { - const { queryByTestId } = await setup(['canEditEstablishment'], false); + it('should not show the check cqc details banner when cqcStatusMatch is true in route data', async () => { + const { queryByTestId } = await setup(['canEditEstablishment'], true); expect(queryByTestId('check-cqc-details-banner')).toBeFalsy(); }); diff --git a/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.ts b/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.ts index fe1e582008..b506751548 100644 --- a/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.ts +++ b/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.ts @@ -36,7 +36,7 @@ export class NewWorkplaceTabComponent implements OnInit, OnDestroy { this.breadcrumbService.show(JourneyType.WORKPLACE_TAB); this.canEditEstablishment = this.permissionsService.can(this.workplace?.uid, 'canEditEstablishment'); this.addWorkplaceDetailsBanner = this.workplace.showAddWorkplaceDetailsBanner; - this.showCqcDetailsBanner = this.route.snapshot.data?.cqcStatusCheck?.cqcStatusMatch; + this.showCqcDetailsBanner = this.route.snapshot.data?.cqcStatusCheck?.cqcStatusMatch === false; } public navigateToTab(event: Event, selectedTab: string): void { diff --git a/frontend/src/app/features/subsidiary/workplace/view-subsidiary-workplace.component.spec.ts b/frontend/src/app/features/subsidiary/workplace/view-subsidiary-workplace.component.spec.ts new file mode 100644 index 0000000000..fa7ca3c32d --- /dev/null +++ b/frontend/src/app/features/subsidiary/workplace/view-subsidiary-workplace.component.spec.ts @@ -0,0 +1,157 @@ +import { HttpClient } from '@angular/common/http'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { ReactiveFormsModule } from '@angular/forms'; +import { ActivatedRoute, Router, RouterModule } from '@angular/router'; +import { RouterTestingModule } from '@angular/router/testing'; +import { PermissionType } from '@core/model/permissions.model'; +import { Roles } from '@core/model/roles.enum'; +import { AuthService } from '@core/services/auth.service'; +import { BreadcrumbService } from '@core/services/breadcrumb.service'; +import { EstablishmentService } from '@core/services/establishment.service'; +import { PermissionsService } from '@core/services/permissions/permissions.service'; +import { UserService } from '@core/services/user.service'; +import { WindowToken } from '@core/services/window'; +import { WindowRef } from '@core/services/window.ref'; +import { MockAuthService } from '@core/test-utils/MockAuthService'; +import { MockBreadcrumbService } from '@core/test-utils/MockBreadcrumbService'; +import { MockEstablishmentServiceCheckCQCDetails } from '@core/test-utils/MockEstablishmentService'; +import { MockFeatureFlagsService } from '@core/test-utils/MockFeatureFlagService'; +import { MockPermissionsService } from '@core/test-utils/MockPermissionsService'; +import { MockUserService } from '@core/test-utils/MockUserService'; +import { FeatureFlagsService } from '@shared/services/feature-flags.service'; +import { SharedModule } from '@shared/shared.module'; +import { render } from '@testing-library/angular'; + +import { Establishment } from '../../../../mockdata/establishment'; +import { NewDashboardHeaderComponent } from '../../../shared/components/new-dashboard-header/dashboard-header.component'; +import { ViewSubsidiaryWorkplaceComponent } from './view-subsidiary-workplace.component'; + +const MockWindow = { + dataLayer: { + push: () => { + return; + }, + }, +}; + +describe('ViewSubsidiaryWorkplaceComponent', () => { + const setup = async ( + permissions = ['canEditEstablishment'], + cqcStatusMatch = true, + establishment = Establishment, + ) => { + const role = Roles.Edit; + const { fixture, getByText, queryByText, getByTestId, queryByTestId } = await render( + ViewSubsidiaryWorkplaceComponent, + { + imports: [SharedModule, RouterModule, RouterTestingModule, HttpClientTestingModule, ReactiveFormsModule], + providers: [ + { + provide: FeatureFlagsService, + useClass: MockFeatureFlagsService, + }, + { + provide: PermissionsService, + useFactory: MockPermissionsService.factory(permissions as PermissionType[]), + deps: [HttpClient, Router, UserService], + }, + { + provide: BreadcrumbService, + useClass: MockBreadcrumbService, + }, + { + provide: EstablishmentService, + useFactory: MockEstablishmentServiceCheckCQCDetails.factory(), + deps: [HttpClient], + }, + { + provide: WindowRef, + useClass: WindowRef, + }, + + { + provide: UserService, + useFactory: MockUserService.factory(0, role), + deps: [HttpClient], + }, + { + provide: AuthService, + useFactory: MockAuthService.factory(true, false), + deps: [HttpClient, Router, EstablishmentService, UserService, PermissionsService], + }, + { + provide: ActivatedRoute, + useValue: { + snapshot: { + data: { + cqcStatusCheck: { cqcStatusMatch }, + establishment, + }, + }, + }, + }, + { provide: WindowToken, useValue: MockWindow }, + ], + declarations: [NewDashboardHeaderComponent], + }, + ); + + const component = fixture.componentInstance; + + return { + component, + getByText, + queryByText, + getByTestId, + queryByTestId, + }; + }; + + it('should create', async () => { + const { component } = await setup(); + expect(component).toBeTruthy(); + }); + + describe('banners', () => { + it('should show the add more details banner with correct href when the showAddWorkplaceDetailsBanner is true and have the correct permissions', async () => { + const establishment = { ...Establishment, showAddWorkplaceDetailsBanner: true }; + const { getByText } = await setup(['canEditEstablishment'], false, establishment); + + const banner = getByText('Start to add more details about your workplace'); + + expect(banner).toBeTruthy(); + expect(banner.getAttribute('href')).toEqual(`/workplace/${establishment.uid}/start`); + }); + + it('should not show the add more details banner when the showAddWorkplaceDetailsBanner is false', async () => { + const { queryByText } = await setup(); + + expect(queryByText('Start to add more details about your workplace')).toBeFalsy(); + }); + + it('should not show the add more details banner when there are not the correct permissions', async () => { + const establishment = { ...Establishment, showAddWorkplaceDetailsBanner: true }; + const { queryByText } = await setup([], false, establishment); + + expect(queryByText('Start to add more details about your workplace')).toBeFalsy(); + }); + + it('should show the check cqc details banner when cqcStatusMatch is false in route data', async () => { + const { getByTestId } = await setup(['canEditEstablishment'], false); + + expect(getByTestId('check-cqc-details-banner')).toBeTruthy(); + }); + + it('should not show the check cqc details banner when cqcStatusMatch is true in route data', async () => { + const { queryByTestId } = await setup(['canEditEstablishment'], true); + + expect(queryByTestId('check-cqc-details-banner')).toBeFalsy(); + }); + + it('should not show the check cqc details banner when there are not the correct permissions', async () => { + const { queryByTestId } = await setup([], true); + + expect(queryByTestId('check-cqc-details-banner')).toBeFalsy(); + }); + }); +}); diff --git a/frontend/src/app/features/subsidiary/workplace/view-subsidiary-workplace.component.ts b/frontend/src/app/features/subsidiary/workplace/view-subsidiary-workplace.component.ts index 8c799f344f..b33c9e5238 100644 --- a/frontend/src/app/features/subsidiary/workplace/view-subsidiary-workplace.component.ts +++ b/frontend/src/app/features/subsidiary/workplace/view-subsidiary-workplace.component.ts @@ -36,7 +36,7 @@ export class ViewSubsidiaryWorkplaceComponent implements OnInit { this.workplace = this.route.snapshot.data.establishment; this.workerCount = this.route.snapshot.data.workers?.workerCount; this.addWorkplaceDetailsBanner = this.workplace.showAddWorkplaceDetailsBanner; - this.showCqcDetailsBanner = this.route.snapshot.data?.cqcStatusCheck?.cqcStatusMatch; + this.showCqcDetailsBanner = this.route.snapshot.data?.cqcStatusCheck?.cqcStatusMatch === false; this.canEditEstablishment = this.permissionsService.can(this.workplace?.uid, 'canEditEstablishment'); } From 1b309e9f5dab616b4aa010ea920e02bf34a89a57 Mon Sep 17 00:00:00 2001 From: Duncan Carter Date: Wed, 3 Jul 2024 16:20:14 +0100 Subject: [PATCH 07/13] Update resolver to get establishent from params instead of establishment service --- .../cqcStatusCheck.resolver.spec.ts | 69 ++++++++++++++++--- .../cqcStatusCheck/cqcStatusCheck.resolver.ts | 36 +++++----- 2 files changed, 79 insertions(+), 26 deletions(-) diff --git a/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.spec.ts b/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.spec.ts index 32af7b5c2f..6236252bdc 100644 --- a/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.spec.ts +++ b/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.spec.ts @@ -1,14 +1,16 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { TestBed } from '@angular/core/testing'; +import { ActivatedRoute, convertToParamMap } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; import { Establishment } from '@core/model/establishment.model'; import { EstablishmentService } from '@core/services/establishment.service'; import { MockEstablishmentService } from '@core/test-utils/MockEstablishmentService'; +import { of } from 'rxjs'; import { CqcStatusCheckResolver } from './cqcStatusCheck.resolver'; describe('CqcStatusCheckResolver', () => { - const setup = () => { + const setup = (establishmentuid = null) => { TestBed.configureTestingModule({ imports: [HttpClientTestingModule, RouterTestingModule.withRoutes([])], providers: [ @@ -17,13 +19,22 @@ describe('CqcStatusCheckResolver', () => { provide: EstablishmentService, useClass: MockEstablishmentService, }, + { + provide: ActivatedRoute, + useValue: { snapshot: { paramMap: convertToParamMap({ establishmentuid }) } }, + }, ], }); + const resolver = TestBed.inject(CqcStatusCheckResolver); + const route = TestBed.inject(ActivatedRoute); const establishmentService = TestBed.inject(EstablishmentService); + const getCqcRegistrationStatusSpy = spyOn(establishmentService, 'getCQCRegistrationStatus').and.callFake(() => + of({ cqcStatusMatch: false }), + ); - return { resolver, establishmentService }; + return { resolver, establishmentService, route, establishmentuid, getCqcRegistrationStatusSpy }; }; it('should be created', async () => { @@ -31,21 +42,59 @@ describe('CqcStatusCheckResolver', () => { expect(resolver).toBeTruthy(); }); - it('should call getCQCRegistrationStatus', async () => { - const { resolver, establishmentService } = await setup(); + it('should call getEstablishment with establishment ID in service when no uid in params', async () => { + const { resolver, establishmentService, route, getCqcRegistrationStatusSpy } = await setup(); + const establishment = { + locationId: '1-11111111', + postcode: 'ABC123', + mainService: { name: 'Care' }, + } as Establishment; + + const getEstablishmentSpy = spyOn(establishmentService, 'getEstablishment').and.callFake(() => of(establishment)); + + resolver.resolve(route.snapshot).subscribe(() => { + expect(getEstablishmentSpy).toHaveBeenCalledWith(establishmentService.establishmentId); + + expect(getCqcRegistrationStatusSpy).toHaveBeenCalledWith(establishment.locationId, { + postcode: establishment.postcode, + mainService: establishment.mainService.name, + }); + }); + }); + + it('should call getCQCRegistrationStatus when workplace has location ID', async () => { + const establishmentuid = 'ab131231dsa2321321a'; + const { resolver, establishmentService, route, getCqcRegistrationStatusSpy } = await setup(establishmentuid); const establishment = { locationId: '1-11111111', postcode: 'ABC123', mainService: { name: 'Care' }, } as Establishment; - spyOnProperty(establishmentService, 'establishment').and.returnValue(establishment); - const getCqcRegistrationStatusSpy = spyOn(establishmentService, 'getCQCRegistrationStatus').and.callThrough(); - resolver.resolve(); + const getEstablishmentSpy = spyOn(establishmentService, 'getEstablishment').and.callFake(() => of(establishment)); + + resolver.resolve(route.snapshot).subscribe(() => { + expect(getEstablishmentSpy).toHaveBeenCalledWith(establishmentuid); + + expect(getCqcRegistrationStatusSpy).toHaveBeenCalledWith(establishment.locationId, { + postcode: establishment.postcode, + mainService: establishment.mainService.name, + }); + }); + }); + + it('should not call getCQCRegistrationStatus when workplace does not have location ID', async () => { + const { resolver, establishmentService, route, establishmentuid, getCqcRegistrationStatusSpy } = await setup(); + const establishment = { + locationId: null, + postcode: 'ABC123', + mainService: { name: 'Care' }, + } as Establishment; + + spyOn(establishmentService, 'getEstablishment').and.callFake(() => of(establishment)); - expect(getCqcRegistrationStatusSpy).toHaveBeenCalledWith(establishment.locationId, { - postcode: establishment.postcode, - mainService: establishment.mainService.name, + resolver.resolve(route.snapshot).subscribe(() => { + expect(getCqcRegistrationStatusSpy).not.toHaveBeenCalled(); }); }); }); diff --git a/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.ts b/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.ts index e8467ba4b9..014e47199b 100644 --- a/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.ts +++ b/frontend/src/app/core/resolvers/cqcStatusCheck/cqcStatusCheck.resolver.ts @@ -1,8 +1,8 @@ import { Injectable } from '@angular/core'; -import { Resolve } from '@angular/router'; +import { ActivatedRouteSnapshot, Resolve } from '@angular/router'; import { EstablishmentService } from '@core/services/establishment.service'; import { Observable, of } from 'rxjs'; -import { catchError } from 'rxjs/operators'; +import { catchError, switchMap } from 'rxjs/operators'; export class CQCRegistrationStatusResponse { cqcStatusMatch: boolean; @@ -12,20 +12,24 @@ export class CQCRegistrationStatusResponse { export class CqcStatusCheckResolver implements Resolve { constructor(private establishmentService: EstablishmentService) {} - resolve(): Observable { - const { locationId, postcode, mainService } = this.establishmentService.establishment; + resolve(route: ActivatedRouteSnapshot): Observable { + const workplaceUid = route.paramMap.get('establishmentuid') + ? route.paramMap.get('establishmentuid') + : this.establishmentService.establishmentId; - if (locationId) { - return this.establishmentService - .getCQCRegistrationStatus(locationId, { - postcode, - mainService: mainService.name, - }) - .pipe( - catchError(() => { - return of(null); - }), - ); - } + return this.establishmentService.getEstablishment(workplaceUid).pipe( + switchMap(({ locationId, postcode, mainService }) => { + if (locationId) { + return this.establishmentService.getCQCRegistrationStatus(locationId, { + postcode, + mainService: mainService.name, + }); + } + return of(null); + }), + catchError(() => { + return of(null); + }), + ); } } From 15fb4dd2e15941691c39d436ed606c97e34d738c Mon Sep 17 00:00:00 2001 From: Duncan Carter Date: Wed, 3 Jul 2024 16:21:02 +0100 Subject: [PATCH 08/13] Update check CQC details banner to use establishment instead of primary workplace --- .../check-cqc-details.component.spec.ts | 14 +++++++++----- .../check-cqc-details.component.ts | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/shared/components/check-cqc-details/check-cqc-details.component.spec.ts b/frontend/src/app/shared/components/check-cqc-details/check-cqc-details.component.spec.ts index 3926416c75..550f79cb75 100644 --- a/frontend/src/app/shared/components/check-cqc-details/check-cqc-details.component.spec.ts +++ b/frontend/src/app/shared/components/check-cqc-details/check-cqc-details.component.spec.ts @@ -2,7 +2,6 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { RouterModule } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; import { EstablishmentService } from '@core/services/establishment.service'; -import { MockEstablishmentService } from '@core/test-utils/MockEstablishmentService'; import { SharedModule } from '@shared/shared.module'; import { render } from '@testing-library/angular'; @@ -10,18 +9,23 @@ import { CheckCQCDetailsComponent } from './check-cqc-details.component'; describe('CheckCQCDetailsComponent', () => { const setup = async () => { + const locationId = '1-11111111'; + const { fixture, getByText } = await render(CheckCQCDetailsComponent, { imports: [SharedModule, RouterModule, RouterTestingModule, HttpClientTestingModule], providers: [ { provide: EstablishmentService, - useClass: MockEstablishmentService, + useValue: { + establishment: { locationId }, + }, }, ], }); + const component = fixture.componentInstance; - return { component, fixture, getByText }; + return { component, fixture, getByText, locationId }; }; it('should render a CheckCQCDetailsComponent', async () => { @@ -30,10 +34,10 @@ describe('CheckCQCDetailsComponent', () => { }); it('should render the link with a href that navigates to the correct cqc page', async () => { - const { component, getByText } = await setup(); + const { getByText, locationId } = await setup(); expect(getByText('Please check your CQC details').getAttribute('href')).toEqual( - `https://www.cqc.org.uk/location/${component.locationId}`, + `https://www.cqc.org.uk/location/${locationId}`, ); }); }); diff --git a/frontend/src/app/shared/components/check-cqc-details/check-cqc-details.component.ts b/frontend/src/app/shared/components/check-cqc-details/check-cqc-details.component.ts index 96d33debc7..4e5c04f33f 100644 --- a/frontend/src/app/shared/components/check-cqc-details/check-cqc-details.component.ts +++ b/frontend/src/app/shared/components/check-cqc-details/check-cqc-details.component.ts @@ -11,6 +11,6 @@ export class CheckCQCDetailsComponent implements OnInit { constructor(private establishmentService: EstablishmentService) {} ngOnInit(): void { - this.locationId = this.establishmentService.primaryWorkplace.locationId; + this.locationId = this.establishmentService.establishment.locationId; } } From dc989811c2f9dbcdd75c3e01ae0bea1c924cb036 Mon Sep 17 00:00:00 2001 From: Duncan Carter Date: Thu, 4 Jul 2024 14:05:15 +0100 Subject: [PATCH 09/13] Update url to use establishment uid instead of always parent --- .../select-main-service/select-main-service-cqc.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/features/workplace/select-main-service/select-main-service-cqc.component.ts b/frontend/src/app/features/workplace/select-main-service/select-main-service-cqc.component.ts index f382240e15..44ac13aa77 100644 --- a/frontend/src/app/features/workplace/select-main-service/select-main-service-cqc.component.ts +++ b/frontend/src/app/features/workplace/select-main-service/select-main-service-cqc.component.ts @@ -51,7 +51,7 @@ export class SelectMainServiceCqcComponent extends Question { if (this.form.valid) { this.establishmentService.mainServiceCQC = this.form.get('cqc').value; - this.router.navigate(['/workplace', this.establishmentService.establishmentId, 'main-service']); + this.router.navigate(['/workplace', this.establishment.uid, 'main-service']); } else { this.errorSummaryService.scrollToErrorSummary(); } From a5b360163e0b00b7e2c722de7657b6a26e4d6297 Mon Sep 17 00:00:00 2001 From: Duncan Carter Date: Fri, 12 Jul 2024 17:16:28 +0100 Subject: [PATCH 10/13] Remove code for setting CQC banner in service as replaced by resolver --- .../core/services/establishment.service.ts | 15 ---------- .../test-utils/MockEstablishmentService.ts | 17 ----------- .../features/dashboard/dashboard.component.ts | 5 ++-- .../workplace-tab.component.spec.ts | 7 ++--- ...y-training-and-qualifications.component.ts | 3 +- ...iew-subsidiary-workplace.component.spec.ts | 5 ++-- .../view-workplace.component.ts | 28 ++----------------- .../workplace-tab/workplace-tab.component.ts | 28 ++----------------- 8 files changed, 13 insertions(+), 95 deletions(-) diff --git a/frontend/src/app/core/services/establishment.service.ts b/frontend/src/app/core/services/establishment.service.ts index 1675a92e1b..5cd54ee377 100644 --- a/frontend/src/app/core/services/establishment.service.ts +++ b/frontend/src/app/core/services/establishment.service.ts @@ -72,7 +72,6 @@ export class EstablishmentService { private _establishment$: BehaviorSubject = new BehaviorSubject(null); private returnTo$ = new BehaviorSubject(null); private _primaryWorkplace$: BehaviorSubject = new BehaviorSubject(null); - private _checkCQCDetailsBanner$: BehaviorSubject = new BehaviorSubject(false); public previousEstablishmentId: string; public isSameLoggedInUser: boolean; public mainServiceCQC: boolean = null; @@ -144,7 +143,6 @@ export class EstablishmentService { this._establishment$.next(establishment); if (this.primaryWorkplace && establishment.uid === this.primaryWorkplace.uid) { this.setPrimaryWorkplace(this.establishment); - this.setCheckCQCDetailsBanner(false); } } @@ -154,7 +152,6 @@ export class EstablishmentService { this._inStaffRecruitmentFlow = false; this.standAloneAccount = false; this.setPrimaryWorkplace(null); - this.setCheckCQCDetailsBanner(false); } public get establishmentId() { @@ -196,18 +193,6 @@ export class EstablishmentService { this.returnTo$.next(returnTo); } - public get checkCQCDetailsBanner$(): Observable { - return this._checkCQCDetailsBanner$.asObservable(); - } - - public get checkCQCDetailsBanner(): boolean { - return this._checkCQCDetailsBanner$.value; - } - - public setCheckCQCDetailsBanner(data: boolean) { - this._checkCQCDetailsBanner$.next(data); - } - public get inStaffRecruitmentFlow() { if (this._inStaffRecruitmentFlow) { return this._inStaffRecruitmentFlow; diff --git a/frontend/src/app/core/test-utils/MockEstablishmentService.ts b/frontend/src/app/core/test-utils/MockEstablishmentService.ts index cc439bb3cf..6e326978ce 100644 --- a/frontend/src/app/core/test-utils/MockEstablishmentService.ts +++ b/frontend/src/app/core/test-utils/MockEstablishmentService.ts @@ -391,20 +391,3 @@ export class MockEstablishmentServiceWithNoEmployerType extends MockEstablishmen return; } } - -@Injectable() -export class MockEstablishmentServiceCheckCQCDetails extends MockEstablishmentService { - private cqcDetailsBanner; - - public static factory(checkCqcDetailsBanner = false) { - return (httpClient: HttpClient) => { - const service = new MockEstablishmentServiceCheckCQCDetails(httpClient); - service.cqcDetailsBanner = checkCqcDetailsBanner; - return service; - }; - } - - public get checkCQCDetailsBanner(): boolean { - return this.cqcDetailsBanner; - } -} diff --git a/frontend/src/app/features/dashboard/dashboard.component.ts b/frontend/src/app/features/dashboard/dashboard.component.ts index f50b1afe60..9a1eee92b2 100644 --- a/frontend/src/app/features/dashboard/dashboard.component.ts +++ b/frontend/src/app/features/dashboard/dashboard.component.ts @@ -3,9 +3,9 @@ import { ActivatedRoute } from '@angular/router'; import { Establishment } from '@core/model/establishment.model'; import { TrainingCounts } from '@core/model/trainingAndQualifications.model'; import { Worker } from '@core/model/worker.model'; -import { BenchmarksServiceBase } from '@core/services/benchmarks-base.service'; import { AlertService } from '@core/services/alert.service'; import { AuthService } from '@core/services/auth.service'; +import { BenchmarksServiceBase } from '@core/services/benchmarks-base.service'; import { EstablishmentService } from '@core/services/establishment.service'; import { PermissionsService } from '@core/services/permissions/permissions.service'; import { UserService } from '@core/services/user.service'; @@ -55,7 +55,7 @@ export class DashboardComponent implements OnInit, OnDestroy { async ngOnInit(): Promise { this.showBanner = history.state?.showBanner; this.authService.isOnAdminScreen = false; - this.showCQCDetailsBanner = this.establishmentService.checkCQCDetailsBanner; + this.showCQCDetailsBanner = this.route.snapshot.data?.cqcStatusCheck?.cqcStatusMatch === false; this.workplace = this.establishmentService.primaryWorkplace; this.showSharingPermissionsBanner = this.workplace.showSharingPermissionsBanner; this.workplaceUid = this.workplace ? this.workplace.uid : null; @@ -63,7 +63,6 @@ export class DashboardComponent implements OnInit, OnDestroy { this.newDataAreaFlag = this.featureFlagsService.newBenchmarksDataArea; this.canSeeNewDataArea = [1, 2, 8].includes(this.workplace.mainService.reportingID); - if (this.workplace) { this.getPermissions(); this.totalStaffRecords = this.route.snapshot.data.totalStaffRecords; diff --git a/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.spec.ts b/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.spec.ts index dc1d8d86be..2da201274c 100644 --- a/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.spec.ts +++ b/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.spec.ts @@ -14,7 +14,7 @@ import { WindowToken } from '@core/services/window'; import { WindowRef } from '@core/services/window.ref'; import { MockAuthService } from '@core/test-utils/MockAuthService'; import { MockBreadcrumbService } from '@core/test-utils/MockBreadcrumbService'; -import { MockEstablishmentServiceCheckCQCDetails } from '@core/test-utils/MockEstablishmentService'; +import { MockEstablishmentService } from '@core/test-utils/MockEstablishmentService'; import { MockFeatureFlagsService } from '@core/test-utils/MockFeatureFlagService'; import { MockPermissionsService } from '@core/test-utils/MockPermissionsService'; import { MockUserService } from '@core/test-utils/MockUserService'; @@ -34,7 +34,7 @@ const MockWindow = { }, }; -describe('NewWorkplaceTabComponent', () => { +fdescribe('NewWorkplaceTabComponent', () => { const setup = async ( permissions = ['canEditEstablishment'], cqcStatusMatch = true, @@ -61,8 +61,7 @@ describe('NewWorkplaceTabComponent', () => { }, { provide: EstablishmentService, - useFactory: MockEstablishmentServiceCheckCQCDetails.factory(), - deps: [HttpClient], + useFClass: MockEstablishmentService, }, { provide: WindowRef, diff --git a/frontend/src/app/features/subsidiary/training-and-qualifications/view-subsidiary-training-and-qualifications.component.ts b/frontend/src/app/features/subsidiary/training-and-qualifications/view-subsidiary-training-and-qualifications.component.ts index 58ea95e062..e352cfcd64 100644 --- a/frontend/src/app/features/subsidiary/training-and-qualifications/view-subsidiary-training-and-qualifications.component.ts +++ b/frontend/src/app/features/subsidiary/training-and-qualifications/view-subsidiary-training-and-qualifications.component.ts @@ -56,7 +56,6 @@ export class ViewSubsidiaryTrainingAndQualificationsComponent implements OnInit ) {} ngOnInit(): void { - this.establishmentService.setCheckCQCDetailsBanner(false); this.breadcrumbService.show(JourneyType.SUBSIDIARY); this.workers = this.route.snapshot.data.workers?.workers; @@ -86,7 +85,7 @@ export class ViewSubsidiaryTrainingAndQualificationsComponent implements OnInit this.trainingTotals(); } } - + public getParentPermissions(): void { const parentUid = this.workplace.parentUid; diff --git a/frontend/src/app/features/subsidiary/workplace/view-subsidiary-workplace.component.spec.ts b/frontend/src/app/features/subsidiary/workplace/view-subsidiary-workplace.component.spec.ts index fa7ca3c32d..0d07ce9362 100644 --- a/frontend/src/app/features/subsidiary/workplace/view-subsidiary-workplace.component.spec.ts +++ b/frontend/src/app/features/subsidiary/workplace/view-subsidiary-workplace.component.spec.ts @@ -14,7 +14,7 @@ import { WindowToken } from '@core/services/window'; import { WindowRef } from '@core/services/window.ref'; import { MockAuthService } from '@core/test-utils/MockAuthService'; import { MockBreadcrumbService } from '@core/test-utils/MockBreadcrumbService'; -import { MockEstablishmentServiceCheckCQCDetails } from '@core/test-utils/MockEstablishmentService'; +import { MockEstablishmentService } from '@core/test-utils/MockEstablishmentService'; import { MockFeatureFlagsService } from '@core/test-utils/MockFeatureFlagService'; import { MockPermissionsService } from '@core/test-utils/MockPermissionsService'; import { MockUserService } from '@core/test-utils/MockUserService'; @@ -61,8 +61,7 @@ describe('ViewSubsidiaryWorkplaceComponent', () => { }, { provide: EstablishmentService, - useFactory: MockEstablishmentServiceCheckCQCDetails.factory(), - deps: [HttpClient], + useClass: MockEstablishmentService, }, { provide: WindowRef, diff --git a/frontend/src/app/features/workplace/view-workplace/view-workplace.component.ts b/frontend/src/app/features/workplace/view-workplace/view-workplace.component.ts index 05889a6d58..729d94a8b0 100644 --- a/frontend/src/app/features/workplace/view-workplace/view-workplace.component.ts +++ b/frontend/src/app/features/workplace/view-workplace/view-workplace.component.ts @@ -5,8 +5,8 @@ import { Establishment } from '@core/model/establishment.model'; import { TrainingCounts } from '@core/model/trainingAndQualifications.model'; import { URLStructure } from '@core/model/url.model'; import { Worker } from '@core/model/worker.model'; -import { BenchmarksServiceBase } from '@core/services/benchmarks-base.service'; import { AlertService } from '@core/services/alert.service'; +import { BenchmarksServiceBase } from '@core/services/benchmarks-base.service'; import { BreadcrumbService } from '@core/services/breadcrumb.service'; import { DialogService } from '@core/services/dialog.service'; import { EstablishmentService } from '@core/services/establishment.service'; @@ -32,7 +32,7 @@ export class ViewWorkplaceComponent implements OnInit, OnDestroy { public totalStaffRecords: number; private subscriptions: Subscription = new Subscription(); public trainingAlert: number; - public showCQCDetailsBanner: boolean = this.establishmentService.checkCQCDetailsBanner; + public showCQCDetailsBanner: boolean; public workers: Worker[]; public trainingCounts: TrainingCounts; public workerCount: number; @@ -58,7 +58,6 @@ export class ViewWorkplaceComponent implements OnInit, OnDestroy { ngOnInit(): void { this.showBanner = history.state?.showBanner; - this.establishmentService.setCheckCQCDetailsBanner(false); this.breadcrumbService.show(JourneyType.ALL_WORKPLACES); this.primaryEstablishment = this.establishmentService.primaryWorkplace; this.workplace = this.establishmentService.establishment; @@ -68,21 +67,8 @@ export class ViewWorkplaceComponent implements OnInit, OnDestroy { this.canDeleteEstablishment = this.permissionsService.can(this.workplace.uid, 'canDeleteEstablishment'); this.newDataAreaFlag = this.featureFlagsService.newBenchmarksDataArea; this.canSeeNewDataArea = [1, 2, 8].includes(this.workplace.mainService.reportingID); + this.showCQCDetailsBanner = this.route.snapshot.data?.cqcStatusCheck?.cqcStatusMatch === false; - if (this.workplace && this.workplace.locationId) { - this.subscriptions.add( - this.establishmentService - .getCQCRegistrationStatus(this.workplace.locationId, { - postcode: this.workplace.postcode, - mainService: this.workplace.mainService.name, - }) - .subscribe((response) => { - this.establishmentService.setCheckCQCDetailsBanner(response.cqcStatusMatch === false); - }), - ); - } - - this.getShowCQCDetailsBanner(); this.showSharingPermissionsBanner = this.workplace.showSharingPermissionsBanner; if (this.canViewListOfWorkers) { @@ -149,14 +135,6 @@ export class ViewWorkplaceComponent implements OnInit, OnDestroy { ); } - private getShowCQCDetailsBanner(): void { - this.subscriptions.add( - this.establishmentService.checkCQCDetailsBanner$.subscribe((showBanner) => { - this.showCQCDetailsBanner = showBanner; - }), - ); - } - private showStaffRecordBanner(): void { this.alertService.addAlert({ type: 'success', diff --git a/frontend/src/app/shared/components/workplace-tab/workplace-tab.component.ts b/frontend/src/app/shared/components/workplace-tab/workplace-tab.component.ts index c49682bbf2..79b663178d 100644 --- a/frontend/src/app/shared/components/workplace-tab/workplace-tab.component.ts +++ b/frontend/src/app/shared/components/workplace-tab/workplace-tab.component.ts @@ -19,7 +19,7 @@ export class WorkplaceTabComponent implements OnInit, OnDestroy { public updateWorkplaceAlert: boolean; public locationId: string; - public showCQCDetailsBanner: boolean = this.establishmentService.checkCQCDetailsBanner; + public showCQCDetailsBanner: boolean; public showSharingPermissionsBanner: boolean; constructor( @@ -36,31 +36,7 @@ export class WorkplaceTabComponent implements OnInit, OnDestroy { this.workplace.showAddWorkplaceDetailsBanner && this.permissionsService.can(this.workplace.uid, 'canEditEstablishment'); - if (this.workplace.locationId) { - this.setCheckCQCDetailsBannerInEstablishmentService(); - } - this.getShowCQCDetailsBanner(); - } - - private getShowCQCDetailsBanner(): void { - this.subscriptions.add( - this.establishmentService.checkCQCDetailsBanner$.subscribe((showBanner) => { - this.showCQCDetailsBanner = showBanner; - }), - ); - } - - private setCheckCQCDetailsBannerInEstablishmentService(): void { - this.subscriptions.add( - this.establishmentService - .getCQCRegistrationStatus(this.workplace.locationId, { - postcode: this.workplace.postcode, - mainService: this.workplace.mainService.name, - }) - .subscribe((response) => { - this.establishmentService.setCheckCQCDetailsBanner(response.cqcStatusMatch === false); - }), - ); + this.showCQCDetailsBanner = this.route.snapshot.data?.cqcStatusCheck?.cqcStatusMatch === false; } public navigateToShareDataPage(e: Event): void { From 8fbe58f7cf1bca7766c24a6e092226b5e6aa7ec6 Mon Sep 17 00:00:00 2001 From: Duncan Carter Date: Mon, 22 Jul 2024 09:14:45 +0100 Subject: [PATCH 11/13] Fix typo to stop tests failing due to no mock establishment service being provided --- .../workplace-tab/workplace-tab.component.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.spec.ts b/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.spec.ts index 2da201274c..cded289d7b 100644 --- a/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.spec.ts +++ b/frontend/src/app/features/new-dashboard/workplace-tab/workplace-tab.component.spec.ts @@ -34,7 +34,7 @@ const MockWindow = { }, }; -fdescribe('NewWorkplaceTabComponent', () => { +describe('NewWorkplaceTabComponent', () => { const setup = async ( permissions = ['canEditEstablishment'], cqcStatusMatch = true, @@ -61,7 +61,7 @@ fdescribe('NewWorkplaceTabComponent', () => { }, { provide: EstablishmentService, - useFClass: MockEstablishmentService, + useClass: MockEstablishmentService, }, { provide: WindowRef, From acb84bc57acbc5268184b8753878fe13c7b6c5b6 Mon Sep 17 00:00:00 2001 From: Duncan Carter Date: Tue, 23 Jul 2024 16:04:19 +0100 Subject: [PATCH 12/13] Update example yaml to include all fields from localhost --- backend/server/config/example.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/server/config/example.yaml b/backend/server/config/example.yaml index 717d618d16..0e291c00ee 100644 --- a/backend/server/config/example.yaml +++ b/backend/server/config/example.yaml @@ -15,12 +15,16 @@ jwt: ttl: login: 60 db: + host: localhost pool: min: 15 max: 15 ssl: false username: sfcadmin +redis: + url: redis://localhost:6379 + log: sequelize: false From c0f3e5bf79af595e99a933e82aee33b6d4ca60f6 Mon Sep 17 00:00:00 2001 From: Duncan Carter Date: Tue, 23 Jul 2024 16:06:05 +0100 Subject: [PATCH 13/13] Update gitignore to have correct filepath of localhost --- .gitignore | 4 +-- backend/server/config/localhost.yaml | 41 ---------------------------- 2 files changed, 1 insertion(+), 44 deletions(-) delete mode 100644 backend/server/config/localhost.yaml diff --git a/.gitignore b/.gitignore index c1deda8cb6..f265209880 100644 --- a/.gitignore +++ b/.gitignore @@ -57,9 +57,7 @@ Thumbs.db fecoverage # localhost config variations -/server/config/localhost.*.yaml -/server/config/localhost-*.yaml -/server/config/localhost.yaml +backend/server/config/localhost.yaml // nodemon localisations nodemon.json diff --git a/backend/server/config/localhost.yaml b/backend/server/config/localhost.yaml deleted file mode 100644 index 0a4065d423..0000000000 --- a/backend/server/config/localhost.yaml +++ /dev/null @@ -1,41 +0,0 @@ -aws: - region: eu-west-1 - secrets: - use: false - wallet: dev/api - sns: - enabled: true - registrations: arn:aws:sns:eu-west-1:364648107127:registrations-dev - feedback: arn:aws:sns:eu-west-1:364648107127:feedback-dev - -slack: - level: 0 # disables Slack notifications -jwt: - iss: 'localhost' - ttl: - login: 60 -db: - host: localhost - pool: - min: 15 - max: 15 - ssl: false - -redis: - url: redis://localhost:6379 - -log: - sequelize: false - -bulkupload: - region: eu-west-2 - bucketname: sfcbulkuploadfiles - validation: - timeout: 600 - completion: - timeout: 600 -sentry: - sample_rate: 0.0 -satisfactionSurvey: - timeSpan: 1 - unit: m