diff --git a/biome.json b/biome.json index ed2ebc1324..6548f30953 100644 --- a/biome.json +++ b/biome.json @@ -72,6 +72,19 @@ } } } + }, + { + "include": [ + "**/*.spec.ts" + ], + "linter": { + "enabled": true, + "rules": { + "suspicious": { + "noExplicitAny": "off" + } + } + } } ] } diff --git a/src/app/__tests__/sentry-error-handler.spec.ts b/src/app/__tests__/sentry-error-handler.spec.ts index a2e9754df7..a306a55fed 100644 --- a/src/app/__tests__/sentry-error-handler.spec.ts +++ b/src/app/__tests__/sentry-error-handler.spec.ts @@ -82,7 +82,7 @@ describe('SentryIonicErrorHandler', () => { ); spyOn(sentryErrorHandler.logHelper, 'createLog').and.returnValue(mockLog); - await sentryErrorHandler.handleError({ err: 'some error' }); + await sentryErrorHandler.handleError({ message: 'some error' }); expect(sentryErrorHandler.store$.dispatch).toHaveBeenCalledWith(SaveLog({ payload: mockLog })); }); it('should not call to any provider if an instance of HttpErrorResponse', async () => { diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 9a965d25d2..682bd2784f 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -87,17 +87,7 @@ export function localStorageSyncReducer(reducer: ActionReducer): Act })(reducer); } -export interface AppState { - journal: JournalState; - appInfo: AppInfoState; - appConfig: AppConfigState; - tests: TestsState; - rekeySearch: RekeySearchState; - delegatedRekeySearch: DelegatedSearchState; - examinerRecords: ExaminerRecordsState; -} - -const reducers: ActionReducerMap = { +const reducers: ActionReducerMap = { journal: journalReducer, appInfo: appInfoReducer, appConfig: appConfigReducer, @@ -107,7 +97,7 @@ const reducers: ActionReducerMap = { examinerRecords: examinerRecordsReducer, }; -const metaReducers: MetaReducer[] = []; +const metaReducers: MetaReducer[] = []; const enableDevTools = environment && (environment as EnvironmentFile).enableDevTools; const enableRehydrationPlugin = environment && (environment as EnvironmentFile).enableRehydrationPlugin; diff --git a/src/app/pages/back-to-office/__tests__/back-to-office.analytics.effects.spec.ts b/src/app/pages/back-to-office/__tests__/back-to-office.analytics.effects.spec.ts index 947b6165a5..0616fb3e5e 100644 --- a/src/app/pages/back-to-office/__tests__/back-to-office.analytics.effects.spec.ts +++ b/src/app/pages/back-to-office/__tests__/back-to-office.analytics.effects.spec.ts @@ -2,7 +2,7 @@ import { TestBed, waitForAsync } from '@angular/core/testing'; import { Application } from '@dvsa/mes-journal-schema'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; @@ -33,7 +33,7 @@ import { BackToOfficeAnalyticsEffects } from '../back-to-office.analytics.effect describe('BackToOfficeAnalyticsEffects', () => { let effects: BackToOfficeAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let store$: Store; const screenName = AnalyticsScreenNames.BACK_TO_OFFICE; const mockApplication: Application = { diff --git a/src/app/pages/candidate-details/__tests__/candidate-details.analytics.effects.spec.ts b/src/app/pages/candidate-details/__tests__/candidate-details.analytics.effects.spec.ts index 3254a510b0..8b0c8c8af8 100644 --- a/src/app/pages/candidate-details/__tests__/candidate-details.analytics.effects.spec.ts +++ b/src/app/pages/candidate-details/__tests__/candidate-details.analytics.effects.spec.ts @@ -2,7 +2,7 @@ import { TestBed, waitForAsync } from '@angular/core/testing'; import { TestSlot } from '@dvsa/mes-journal-schema'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { CandidateDetailsAnalyticsEffects } from '@pages/candidate-details/candidate-details.analytics.effects'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsProvider } from '@providers/analytics/analytics'; @@ -30,7 +30,7 @@ import { ReplaySubject } from 'rxjs'; describe('CandidateDetailsAnalyticsEffects', () => { let effects: CandidateDetailsAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let store$: Store; const screenName = AnalyticsScreenNames.CANDIDATE_DETAILS; const mockTestSlot = { diff --git a/src/app/pages/candidate-licence/__tests__/candidate-licence.analytics.effects.spec.ts b/src/app/pages/candidate-licence/__tests__/candidate-licence.analytics.effects.spec.ts index b4dfd2ddce..d89afa5d83 100644 --- a/src/app/pages/candidate-licence/__tests__/candidate-licence.analytics.effects.spec.ts +++ b/src/app/pages/candidate-licence/__tests__/candidate-licence.analytics.effects.spec.ts @@ -3,7 +3,7 @@ import { Router } from '@angular/router'; import { Application } from '@dvsa/mes-journal-schema'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { CandidateLicenceAnalyticsEffects } from '@pages/candidate-licence/candidate-licence.analytics.effects'; import { TestFlowPageNames } from '@pages/page-names.constants'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; @@ -27,7 +27,7 @@ import * as candidateLicenceActions from '../candidate-licence.actions'; describe('CommunicationAnalyticsEffects', () => { let effects: CandidateLicenceAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let store$: Store; const screenName = AnalyticsScreenNames.CANDIDATE_LICENCE_INFO; const mockApplication: Application = { diff --git a/src/app/pages/communication/__tests__/communication.analytics.effects.spec.ts b/src/app/pages/communication/__tests__/communication.analytics.effects.spec.ts index 4f9a126828..34d7eb862d 100644 --- a/src/app/pages/communication/__tests__/communication.analytics.effects.spec.ts +++ b/src/app/pages/communication/__tests__/communication.analytics.effects.spec.ts @@ -3,7 +3,7 @@ import { Router } from '@angular/router'; import { Application } from '@dvsa/mes-journal-schema'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { TestFlowPageNames } from '@pages/page-names.constants'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsProvider } from '@providers/analytics/analytics'; @@ -39,7 +39,7 @@ import { CommunicationAnalyticsEffects } from '../communication.analytics.effect describe('CommunicationAnalyticsEffects', () => { let effects: CommunicationAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let store$: Store; const screenName = AnalyticsScreenNames.COMMUNICATION; const screenNamePM = `${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${AnalyticsScreenNames.COMMUNICATION}`; diff --git a/src/app/pages/communication/__tests__/communication.effects.spec.ts b/src/app/pages/communication/__tests__/communication.effects.spec.ts index 57b8e1c0bc..f793da1e54 100644 --- a/src/app/pages/communication/__tests__/communication.effects.spec.ts +++ b/src/app/pages/communication/__tests__/communication.effects.spec.ts @@ -1,6 +1,6 @@ import { TestBed, waitForAsync } from '@angular/core/testing'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import * as testStatusActions from '@store/tests/test-status/test-status.actions'; import * as testsActions from '@store/tests/tests.actions'; import { ReplaySubject } from 'rxjs'; @@ -9,7 +9,7 @@ import { CommunicationEffects } from '../communication.effects'; describe('CommunicationEffects', () => { let effects: CommunicationEffects; - let actions$: ReplaySubject; + let actions$: ReplaySubject; const currentSlotId = '1234'; beforeEach(waitForAsync(() => { diff --git a/src/app/pages/confirm-test-details/__tests__/confirm-test-details.analytics.effects.spec.ts b/src/app/pages/confirm-test-details/__tests__/confirm-test-details.analytics.effects.spec.ts index f5e19f82cb..54028fe1f8 100644 --- a/src/app/pages/confirm-test-details/__tests__/confirm-test-details.analytics.effects.spec.ts +++ b/src/app/pages/confirm-test-details/__tests__/confirm-test-details.analytics.effects.spec.ts @@ -1,6 +1,6 @@ import { TestBed, waitForAsync } from '@angular/core/testing'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { testsReducer } from '@store/tests/tests.reducer'; import { ReplaySubject } from 'rxjs'; @@ -25,7 +25,7 @@ import * as confirmTestDetailsActions from '../confirm-test-details.actions'; describe('ConfirmTestDetailsAnalyticsEffects', () => { let effects: ConfirmTestDetailsAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let store$: Store; const screenName = AnalyticsScreenNames.CONFIRM_TEST_DETAILS; diff --git a/src/app/pages/confirm-test-details/components/confirm-submit-modal/__tests__/submit-modal.spec.ts b/src/app/pages/confirm-test-details/components/confirm-submit-modal/__tests__/submit-modal.spec.ts index 7a30e35216..1719e77ed3 100644 --- a/src/app/pages/confirm-test-details/components/confirm-submit-modal/__tests__/submit-modal.spec.ts +++ b/src/app/pages/confirm-test-details/components/confirm-submit-modal/__tests__/submit-modal.spec.ts @@ -35,7 +35,7 @@ describe('ConfirmSubmitModal', () => { }); const mockValue = mockFile.mockSlotDetail(); - spyOn(navMock, 'get').and.returnValue(mockValue); + spyOn(navMock, 'get').and.returnValue(mockValue.start); modalFixture = TestBed.createComponent(ConfirmSubmitModal); modalComponent = modalFixture.componentInstance; spyOn(modalComponent.modalController, 'dismiss').and.returnValue(Promise.resolve(true)); diff --git a/src/app/pages/dashboard/__tests__/dashboard.analytics.effects.spec.ts b/src/app/pages/dashboard/__tests__/dashboard.analytics.effects.spec.ts index 6bd36cfd29..ce379e6cc0 100644 --- a/src/app/pages/dashboard/__tests__/dashboard.analytics.effects.spec.ts +++ b/src/app/pages/dashboard/__tests__/dashboard.analytics.effects.spec.ts @@ -13,7 +13,7 @@ import { } from '@providers/analytics/analytics.model'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { UpdateAvailable } from '@pages/dashboard/components/update-available-modal/update-available-modal'; import { AppConfigProviderMock } from '@providers/app-config/__mocks__/app-config.mock'; import { AppConfigProvider } from '@providers/app-config/app-config'; @@ -31,7 +31,7 @@ import { DashboardAnalyticsEffects } from '../dashboard.analytics.effects'; describe('DashboardAnalyticsEffects', () => { let effects: DashboardAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; const screenName = AnalyticsScreenNames.DASHBOARD; beforeEach(waitForAsync(() => { diff --git a/src/app/pages/debrief/__tests__/debrief.analytics.effects.spec.ts b/src/app/pages/debrief/__tests__/debrief.analytics.effects.spec.ts index c4b77631f3..460e6320f6 100644 --- a/src/app/pages/debrief/__tests__/debrief.analytics.effects.spec.ts +++ b/src/app/pages/debrief/__tests__/debrief.analytics.effects.spec.ts @@ -1,7 +1,7 @@ import { TestBed, waitForAsync } from '@angular/core/testing'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule, Action } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; diff --git a/src/app/pages/debrief/__tests__/debrief.effects.spec.ts b/src/app/pages/debrief/__tests__/debrief.effects.spec.ts index 389cdb292e..41fe449df2 100644 --- a/src/app/pages/debrief/__tests__/debrief.effects.spec.ts +++ b/src/app/pages/debrief/__tests__/debrief.effects.spec.ts @@ -1,7 +1,7 @@ import { TestBed, waitForAsync } from '@angular/core/testing'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule, Action } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { ActivityCodes } from '@shared/models/activity-codes'; import { StoreModel } from '@shared/models/store.model'; import * as activityCodeActions from '@store/tests/activity-code/activity-code.actions'; diff --git a/src/app/pages/debrief/components/driving-faults-debrief-card/__tests__/driving-faults-debrief-card.spec.ts b/src/app/pages/debrief/components/driving-faults-debrief-card/__tests__/driving-faults-debrief-card.spec.ts index a9124e8c40..5ea97d25f7 100644 --- a/src/app/pages/debrief/components/driving-faults-debrief-card/__tests__/driving-faults-debrief-card.spec.ts +++ b/src/app/pages/debrief/components/driving-faults-debrief-card/__tests__/driving-faults-debrief-card.spec.ts @@ -81,10 +81,10 @@ describe('DrivingFaultsDebriefCardComponent', () => { const drivingFaultsLabels = fixture.debugElement.queryAll(By.css('#driving-fault .counter-label')); const drivingFaultCount = fixture.debugElement.query(By.css('ion-text.fault-heading')).nativeElement; expect(drivingFaultsLabels[0].nativeElement.innerHTML.trim()).toBe( - (welshTranslations).debrief.competencies.useOfSpeed + welshTranslations.debrief.competencies.useOfSpeed ); expect(drivingFaultsLabels[1].nativeElement.innerHTML.trim()).toBe( - (welshTranslations).debrief.competencies.signalsTimed + welshTranslations.debrief.competencies.signalsTimed ); expect(drivingFaultCount.innerHTML).toBe(drivingFaults.length.toString()); done(); diff --git a/src/app/pages/debrief/components/safety-and-balance-card/__tests__/safety-and-balance-card.cat-a-mod2.spec.ts b/src/app/pages/debrief/components/safety-and-balance-card/__tests__/safety-and-balance-card.cat-a-mod2.spec.ts index bdc78ce745..6bdfea03d5 100644 --- a/src/app/pages/debrief/components/safety-and-balance-card/__tests__/safety-and-balance-card.cat-a-mod2.spec.ts +++ b/src/app/pages/debrief/components/safety-and-balance-card/__tests__/safety-and-balance-card.cat-a-mod2.spec.ts @@ -69,9 +69,7 @@ describe('SafetyAndBalanceCardCatAMod2Component', () => { By.css('#safety-and-balance-questions .counter-label') ).nativeElement; - expect(safetyQuestionText.innerHTML.trim()).toContain( - (englishTranslations).debrief.safetyAndBalanceQuestions.M4 - ); + expect(safetyQuestionText.innerHTML.trim()).toContain(englishTranslations.debrief.safetyAndBalanceQuestions.M4); }); it('should show results in Welsh for a Welsh test', (done) => { @@ -93,9 +91,7 @@ describe('SafetyAndBalanceCardCatAMod2Component', () => { By.css('#safety-and-balance-questions .counter-label') ).nativeElement; - expect(safetyQuestionText.innerHTML.trim()).toContain( - (welshTranslations).debrief.safetyAndBalanceQuestions.M4 - ); + expect(safetyQuestionText.innerHTML.trim()).toContain(welshTranslations.debrief.safetyAndBalanceQuestions.M4); done(); }); }); diff --git a/src/app/pages/debrief/components/serious-faults-debrief-card/__tests__/serious-faults-debrief-card.spec.ts b/src/app/pages/debrief/components/serious-faults-debrief-card/__tests__/serious-faults-debrief-card.spec.ts index 7fb16007e6..a81ea37a9d 100644 --- a/src/app/pages/debrief/components/serious-faults-debrief-card/__tests__/serious-faults-debrief-card.spec.ts +++ b/src/app/pages/debrief/components/serious-faults-debrief-card/__tests__/serious-faults-debrief-card.spec.ts @@ -51,10 +51,10 @@ describe('SeriousFaultsDebriefCardComponent', () => { const drivingFaultsLabels = fixture.debugElement.queryAll(By.css('#serious-fault .counter-label')); const drivingFaultCount = fixture.debugElement.query(By.css('ion-text.fault-heading')).nativeElement; expect(drivingFaultsLabels[0].nativeElement.innerHTML.trim()).toBe( - (welshTranslations).debrief.competencies.useOfSpeed + welshTranslations.debrief.competencies.useOfSpeed ); expect(drivingFaultsLabels[1].nativeElement.innerHTML.trim()).toBe( - (welshTranslations).debrief.competencies.signalsTimed + welshTranslations.debrief.competencies.signalsTimed ); expect(drivingFaultCount.innerHTML).toBe(seriousFaults.length.toString()); done(); diff --git a/src/app/pages/debrief/components/vehicle-checks-card-cat-b/__tests__/vehicle-checks-card.cat-b.spec.ts b/src/app/pages/debrief/components/vehicle-checks-card-cat-b/__tests__/vehicle-checks-card.cat-b.spec.ts index 845d332fac..c76abe8f12 100644 --- a/src/app/pages/debrief/components/vehicle-checks-card-cat-b/__tests__/vehicle-checks-card.cat-b.spec.ts +++ b/src/app/pages/debrief/components/vehicle-checks-card-cat-b/__tests__/vehicle-checks-card.cat-b.spec.ts @@ -105,7 +105,7 @@ describe('VehicleChecksCardCatBComponent', () => { translate.use('cy').subscribe(() => { fixture.detectChanges(); const tellMeQuestionText = fixture.debugElement.query(By.css('#tell-me-question')).nativeElement; - const { tellMeQuestion, incorrect } = (welshTranslations).debrief; + const { tellMeQuestion, incorrect } = welshTranslations.debrief; expect(tellMeQuestionText.innerHTML.trim()).toBe(`${tellMeQuestion} - ${incorrect}`); done(); }); @@ -128,7 +128,7 @@ describe('VehicleChecksCardCatBComponent', () => { translate.use('cy').subscribe(() => { fixture.detectChanges(); const showMeQuestionText = fixture.debugElement.query(By.css('#show-me-question-outcome-df')).nativeElement; - const { showMeQuestion, incorrect } = (welshTranslations).debrief; + const { showMeQuestion, incorrect } = welshTranslations.debrief; const expectedTranslation = `${showMeQuestion} - ${incorrect}`; expect(showMeQuestionText.innerHTML.trim()).toBe(expectedTranslation); done(); @@ -150,7 +150,7 @@ describe('VehicleChecksCardCatBComponent', () => { translate.use('cy').subscribe(() => { fixture.detectChanges(); const showMeQuestionText = fixture.debugElement.query(By.css('#show-me-question-outcome-s')).nativeElement; - const { showMeQuestion, seriousFault } = (welshTranslations).debrief; + const { showMeQuestion, seriousFault } = welshTranslations.debrief; const expectedTranslation = `${showMeQuestion} - ${seriousFault}`; expect(showMeQuestionText.innerHTML.trim()).toBe(expectedTranslation); done(); @@ -172,7 +172,7 @@ describe('VehicleChecksCardCatBComponent', () => { translate.use('cy').subscribe(() => { fixture.detectChanges(); const showMeQuestionText = fixture.debugElement.query(By.css('#show-me-question-outcome-d')).nativeElement; - const { showMeQuestion, dangerousFault } = (welshTranslations).debrief; + const { showMeQuestion, dangerousFault } = welshTranslations.debrief; const expectedTranslation = `${showMeQuestion} - ${dangerousFault}`; expect(showMeQuestionText.innerHTML.trim()).toBe(expectedTranslation); done(); diff --git a/src/app/pages/debrief/components/vehicle-checks-card/__tests__/vehicle-checks-card.spec.ts b/src/app/pages/debrief/components/vehicle-checks-card/__tests__/vehicle-checks-card.spec.ts index fb3737c60a..f2ed905f31 100644 --- a/src/app/pages/debrief/components/vehicle-checks-card/__tests__/vehicle-checks-card.spec.ts +++ b/src/app/pages/debrief/components/vehicle-checks-card/__tests__/vehicle-checks-card.spec.ts @@ -99,7 +99,7 @@ describe('VehicleChecksCardComponent', () => { const tellMeQuestionText = fixture.debugElement.query(By.css('#vehicle-checks .counter-label')).nativeElement; expect(tellMeQuestionText.innerHTML.trim()).toContain( - (englishTranslations).debrief.showMeTellMeQuestions[TestCategory.BE].S01 + englishTranslations.debrief.showMeTellMeQuestions[TestCategory.BE].S01 ); }); @@ -121,8 +121,8 @@ describe('VehicleChecksCardComponent', () => { const tellMeQuestionText = fixture.debugElement.query(By.css('#vehicle-checks .counter-label')).nativeElement; expect(tellMeQuestionText.innerHTML.trim()).toContain( - (welshTranslations).debrief.showMeTellMeQuestions[TestCategory.BE].S01 - ) + welshTranslations.debrief.showMeTellMeQuestions[TestCategory.BE].S01 + ); done(); }); }); diff --git a/src/app/pages/delegated-rekey-search/__tests__/delegated-rekey-search.effects.spec.ts b/src/app/pages/delegated-rekey-search/__tests__/delegated-rekey-search.effects.spec.ts index 5735bb0e89..1eb11db042 100644 --- a/src/app/pages/delegated-rekey-search/__tests__/delegated-rekey-search.effects.spec.ts +++ b/src/app/pages/delegated-rekey-search/__tests__/delegated-rekey-search.effects.spec.ts @@ -2,7 +2,7 @@ import { HttpErrorResponse, HttpStatusCode } from '@angular/common/http'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { TestBed, waitForAsync } from '@angular/core/testing'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { AppConfigProviderMock } from '@providers/app-config/__mocks__/app-config.mock'; import { AppConfigProvider } from '@providers/app-config/app-config'; import { DelegatedRekeySearchProvider } from '@providers/delegated-rekey-search/delegated-rekey-search'; @@ -17,13 +17,13 @@ import * as delegatedRekeySearchActions from '../delegated-rekey-search.actions' import { DelegatedRekeySearchEffects } from '../delegated-rekey-search.effects'; import { delegatedSearchReducer } from '../delegated-rekey-search.reducer'; -function asyncError(errorObject: any) { +function asyncError(errorObject: { status: number; error: string }) { return defer(() => Promise.reject(errorObject)); } describe('DelegatedRekeySearchEffects', () => { let effects: DelegatedRekeySearchEffects; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let delegatedRekeySearchProvider: DelegatedRekeySearchProvider; let searchProvider: SearchProvider; diff --git a/src/app/pages/delegated-rekey-search/delegated-rekey-search.effects.ts b/src/app/pages/delegated-rekey-search/delegated-rekey-search.effects.ts index 4e1f5297f4..3472bacf00 100644 --- a/src/app/pages/delegated-rekey-search/delegated-rekey-search.effects.ts +++ b/src/app/pages/delegated-rekey-search/delegated-rekey-search.effects.ts @@ -38,40 +38,40 @@ export class DelegatedRekeySearchEffects { catchError((err: HttpErrorResponse): Observable => { if (err.status === HttpStatusCode.BadRequest) { return this.delegatedRekeySearchProvider.getDelegatedExaminerBookingByAppRef(action.appRef).pipe( - switchMap((response: any): Observable => { + switchMap((response: DelegatedExaminerTestSlot): Observable => { let delegatedExaminerTestSlot: DelegatedExaminerTestSlot; try { delegatedExaminerTestSlot = { testCentre: { - centreId: response.testSlot.testCentre.centreId, - centreName: response.testSlot.testCentre.centreName, - costCode: response.testSlot.testCentre.costCode, + centreId: response.testCentre.centreId, + centreName: response.testCentre.centreName, + costCode: response.testCentre.costCode, }, booking: { application: { - applicationId: response.testSlot.booking.application.applicationId, - bookingSequence: response.testSlot.booking.application.bookingSequence, - checkDigit: response.testSlot.booking.application.checkDigit, - testCategory: response.testSlot.booking.application.testCategory, + applicationId: response.booking.application.applicationId, + bookingSequence: response.booking.application.bookingSequence, + checkDigit: response.booking.application.checkDigit, + testCategory: response.booking.application.testCategory, welshTest: false, extendedTest: false, }, candidate: { - candidateId: response.testSlot.booking.candidate.candidateId, + candidateId: response.booking.candidate.candidateId, candidateName: { - firstName: response.testSlot.booking.candidate.candidateName.firstName, - lastName: response.testSlot.booking.candidate.candidateName.lastName, + firstName: response.booking.candidate.candidateName.firstName, + lastName: response.booking.candidate.candidateName.lastName, }, - driverNumber: response.testSlot.booking.candidate.driverNumber, - dateOfBirth: response.testSlot.booking.candidate.dateOfBirth, - gender: response.testSlot.booking.candidate.gender, + driverNumber: response.booking.candidate.driverNumber, + dateOfBirth: response.booking.candidate.dateOfBirth, + gender: response.booking.candidate.gender, }, }, slotDetail: { - slotId: response.testSlot.slotDetail.slotId, - start: response.testSlot.slotDetail.start, + slotId: response.slotDetail.slotId, + start: response.slotDetail.start, }, - vehicleTypeCode: response.testSlot.vehicleTypeCode, + vehicleTypeCode: response.vehicleTypeCode, examinerId: response.examinerId, }; return of(SearchBookedDelegatedTestSuccess(delegatedExaminerTestSlot)); diff --git a/src/app/pages/examiner-records/__tests__/examiner-records.analytics.effects.spec.ts b/src/app/pages/examiner-records/__tests__/examiner-records.analytics.effects.spec.ts index d893a42bc9..8c14769433 100644 --- a/src/app/pages/examiner-records/__tests__/examiner-records.analytics.effects.spec.ts +++ b/src/app/pages/examiner-records/__tests__/examiner-records.analytics.effects.spec.ts @@ -1,7 +1,7 @@ import { TestBed, waitForAsync } from '@angular/core/testing'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, Action } from '@ngrx/store'; +import { Action, Store } from '@ngrx/store'; import { ClickDataCard, ColourFilterChanged, diff --git a/src/app/pages/examiner-records/components/examiner-reports-card/__tests__/examiner-reports-card.spec.ts b/src/app/pages/examiner-records/components/examiner-reports-card/__tests__/examiner-reports-card.spec.ts index ddcd016f44..2ae779564d 100644 --- a/src/app/pages/examiner-records/components/examiner-reports-card/__tests__/examiner-reports-card.spec.ts +++ b/src/app/pages/examiner-records/components/examiner-reports-card/__tests__/examiner-reports-card.spec.ts @@ -151,7 +151,7 @@ describe('ExaminerReportsCard', () => { ['1', 1, 'test'], ['2', 2, 'test'], ['3', 7, 'test'], - ] as any[][]); + ] as string[][]); }); it('should return an empty array if the passed data is empty', () => { expect(component.filterDataForGrid(null)).toEqual([[]]); diff --git a/src/app/pages/examiner-records/components/examiner-reports-card/examiner-reports-card.ts b/src/app/pages/examiner-records/components/examiner-reports-card/examiner-reports-card.ts index afc51557a5..5dc03cc083 100644 --- a/src/app/pages/examiner-records/components/examiner-reports-card/examiner-reports-card.ts +++ b/src/app/pages/examiner-records/components/examiner-reports-card/examiner-reports-card.ts @@ -18,7 +18,7 @@ export class ExaminerReportsCard { onCardClick: EventEmitter = new EventEmitter(); @Input() - passedData: ExaminerRecordDataWithPercentage[] = null; + passedData: ExaminerRecordDataWithPercentage[] = null; @Input() chartID: string = null; @Input() diff --git a/src/app/pages/examiner-records/examiner-records.page.ts b/src/app/pages/examiner-records/examiner-records.page.ts index 9dc8e30797..0bf23ca863 100644 --- a/src/app/pages/examiner-records/examiner-records.page.ts +++ b/src/app/pages/examiner-records/examiner-records.page.ts @@ -102,7 +102,7 @@ interface ExaminerRecordsState { styleUrls: ['./examiner-records.page.scss'], }) export class ExaminerRecordsPage implements OnInit { - merged$: Observable; + merged$: Observable; form: UntypedFormGroup = new UntypedFormGroup({}); testSubject$: BehaviorSubject = new BehaviorSubject(null); testsInRangeSubject$: BehaviorSubject = new BehaviorSubject(null); diff --git a/src/app/pages/fake-journal/__tests__/fake-journal.analytics.effects.spec.ts b/src/app/pages/fake-journal/__tests__/fake-journal.analytics.effects.spec.ts index b7645b492d..0eaf0032bf 100644 --- a/src/app/pages/fake-journal/__tests__/fake-journal.analytics.effects.spec.ts +++ b/src/app/pages/fake-journal/__tests__/fake-journal.analytics.effects.spec.ts @@ -12,13 +12,14 @@ import { GoogleAnalyticsEventsTitles, } from '@providers/analytics/analytics.model'; +import { Action } from '@ngrx/store'; import * as fakeJournalActions from '../fake-journal.actions'; import { FakeJournalAnalyticsEffects } from '../fake-journal.analytics.effects'; describe('FakeJournalAnalyticsEffects', () => { let effects: FakeJournalAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; const screenName = AnalyticsScreenNames.FAKE_JOURNAL; beforeEach(waitForAsync(() => { diff --git a/src/app/pages/health-declaration/__tests__/health-declaration.analytics.effects.spec.ts b/src/app/pages/health-declaration/__tests__/health-declaration.analytics.effects.spec.ts index 2a805da8b6..13184cb4ef 100644 --- a/src/app/pages/health-declaration/__tests__/health-declaration.analytics.effects.spec.ts +++ b/src/app/pages/health-declaration/__tests__/health-declaration.analytics.effects.spec.ts @@ -1,7 +1,7 @@ import { TestBed, waitForAsync } from '@angular/core/testing'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule, Action } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; diff --git a/src/app/pages/health-declaration/__tests__/health-declaration.effects.spec.ts b/src/app/pages/health-declaration/__tests__/health-declaration.effects.spec.ts index 68057ef89c..7e981d7b97 100644 --- a/src/app/pages/health-declaration/__tests__/health-declaration.effects.spec.ts +++ b/src/app/pages/health-declaration/__tests__/health-declaration.effects.spec.ts @@ -1,6 +1,6 @@ import { TestBed, waitForAsync } from '@angular/core/testing'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule, Action } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import * as testsActions from '@store/tests/tests.actions'; import { ReplaySubject } from 'rxjs'; import * as healthDeclarationActions from '../health-declaration.actions'; diff --git a/src/app/pages/health-declaration/__tests__/health-declaration.page.spec.ts b/src/app/pages/health-declaration/__tests__/health-declaration.page.spec.ts index 3c1f147c6f..e8ae2db486 100644 --- a/src/app/pages/health-declaration/__tests__/health-declaration.page.spec.ts +++ b/src/app/pages/health-declaration/__tests__/health-declaration.page.spec.ts @@ -236,7 +236,9 @@ describe('HealthDeclarationPage', () => { translate.onLangChange.subscribe(() => { fixture.detectChanges(); const declarationIntent = fixture.debugElement.query(By.css('ion-text.des-header-style-4')).nativeElement; - expect(declarationIntent.innerHTML).toBe(`${(welshTranslations as WelshTranslations).healthDeclaration.declarationIntent}:`); + expect(declarationIntent.innerHTML).toBe( + `${(welshTranslations as WelshTranslations).healthDeclaration.declarationIntent}:` + ); done(); }); }); diff --git a/src/app/pages/health-declaration/components/health-declaration-modal/__tests__/health-declaration-modal.spec.ts b/src/app/pages/health-declaration/components/health-declaration-modal/__tests__/health-declaration-modal.spec.ts index 030e8344e0..292fa05fbe 100644 --- a/src/app/pages/health-declaration/components/health-declaration-modal/__tests__/health-declaration-modal.spec.ts +++ b/src/app/pages/health-declaration/components/health-declaration-modal/__tests__/health-declaration-modal.spec.ts @@ -35,7 +35,7 @@ describe('healthDeclarationModal', () => { }); const mockValue = mockFile.mockSlotDetail(); - spyOn(navMock, 'get').and.returnValue(mockValue); + spyOn(navMock, 'get').and.returnValue(mockValue.start); modalFixture = TestBed.createComponent(HealthDeclarationModal); modalComponent = modalFixture.componentInstance; spyOn(modalComponent.modalController, 'dismiss').and.returnValue(Promise.resolve(true)); diff --git a/src/app/pages/journal/__tests__/journal.analytics.effects.spec.ts b/src/app/pages/journal/__tests__/journal.analytics.effects.spec.ts index 50878e147a..5aeef7bfe1 100644 --- a/src/app/pages/journal/__tests__/journal.analytics.effects.spec.ts +++ b/src/app/pages/journal/__tests__/journal.analytics.effects.spec.ts @@ -1,7 +1,7 @@ import { TestBed, waitForAsync } from '@angular/core/testing'; import { Candidate } from '@dvsa/mes-test-schema/categories/common'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule, Action } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; diff --git a/src/app/pages/journal/components/journal-early-start-modal/__tests__/journal-early-start-modal.spec.ts b/src/app/pages/journal/components/journal-early-start-modal/__tests__/journal-early-start-modal.spec.ts index 8175b45a19..42b2db5e2d 100644 --- a/src/app/pages/journal/components/journal-early-start-modal/__tests__/journal-early-start-modal.spec.ts +++ b/src/app/pages/journal/components/journal-early-start-modal/__tests__/journal-early-start-modal.spec.ts @@ -30,7 +30,7 @@ describe('JournalEarlyStartModal', () => { ], }); const mockValue = mockFile.mockSlotDetail(); - spyOn(navMock, 'get').and.returnValue(mockValue); + spyOn(navMock, 'get').and.returnValue(mockValue.start); modalFixture = TestBed.createComponent(JournalEarlyStartModal); modalComponent = modalFixture.componentInstance; spyOn(modalComponent, 'getStartTime'); diff --git a/src/app/pages/journal/journal.page.ts b/src/app/pages/journal/journal.page.ts index 045504fdba..7dc5dc62c8 100644 --- a/src/app/pages/journal/journal.page.ts +++ b/src/app/pages/journal/journal.page.ts @@ -71,7 +71,7 @@ export class JournalPage extends BasePageComponent implements OnInit { pageState: JournalPageState; pageRefresher: IonRefresherCustomEvent; subscription: Subscription; - merged$: Observable; + merged$: Observable>; todaysDate: DateTime; platformSubscription: Subscription; diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index b5aa8d9665..68c23617f1 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -92,7 +92,7 @@ export class LoginPage extends LogoutBasePageComponent implements OnInit { this.queryParamSub?.unsubscribe(); } - login = async (): Promise => { + login = async (): Promise => { try { await this.handleLoadingUI(true); diff --git a/src/app/pages/non-pass-finalisation/__tests__/non-pass-finalisation.analytics.effects.spec.ts b/src/app/pages/non-pass-finalisation/__tests__/non-pass-finalisation.analytics.effects.spec.ts index f2b7ff35eb..eed74efb06 100644 --- a/src/app/pages/non-pass-finalisation/__tests__/non-pass-finalisation.analytics.effects.spec.ts +++ b/src/app/pages/non-pass-finalisation/__tests__/non-pass-finalisation.analytics.effects.spec.ts @@ -1,7 +1,7 @@ import { TestBed, waitForAsync } from '@angular/core/testing'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticNotRecorded, AnalyticRecorded } from '@providers/analytics/analytics.actions'; @@ -33,7 +33,7 @@ import { NonPassFinalisationAnalyticsEffects } from '../non-pass-finalisation.an describe('NonPassFinalisationAnalyticsEffects', () => { let effects: NonPassFinalisationAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let store$: Store; const screenName = AnalyticsScreenNames.NON_PASS_FINALISATION; diff --git a/src/app/pages/office/__tests__/office.analytics.effects.spec.ts b/src/app/pages/office/__tests__/office.analytics.effects.spec.ts index 99979ffb64..61a66a6c39 100644 --- a/src/app/pages/office/__tests__/office.analytics.effects.spec.ts +++ b/src/app/pages/office/__tests__/office.analytics.effects.spec.ts @@ -2,7 +2,7 @@ import { TestBed, waitForAsync } from '@angular/core/testing'; import { Application } from '@dvsa/mes-journal-schema'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; @@ -39,7 +39,7 @@ import { OfficeAnalyticsEffects } from '../office.analytics.effects'; describe('OfficeAnalyticsEffects', () => { let effects: OfficeAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let store$: Store; const screenNamePass = AnalyticsScreenNames.PASS_TEST_SUMMARY; const screenNameFail = AnalyticsScreenNames.FAIL_TEST_SUMMARY; diff --git a/src/app/pages/office/__tests__/office.effects.spec.ts b/src/app/pages/office/__tests__/office.effects.spec.ts index c59066ded7..4938122dd1 100644 --- a/src/app/pages/office/__tests__/office.effects.spec.ts +++ b/src/app/pages/office/__tests__/office.effects.spec.ts @@ -1,6 +1,6 @@ import { TestBed, waitForAsync } from '@angular/core/testing'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { AddDangerousFaultComment } from '@store/tests/test-data/common/dangerous-faults/dangerous-faults.actions'; import { AddDrivingFaultComment } from '@store/tests/test-data/common/driving-faults/driving-faults.actions'; import { AddSeriousFaultComment } from '@store/tests/test-data/common/serious-faults/serious-faults.actions'; @@ -14,7 +14,7 @@ import { OfficeEffects } from '../office.effects'; describe('OfficeEffects', () => { let effects: OfficeEffects; - let actions$: ReplaySubject; + let actions$: ReplaySubject; const currentSlotId = '1234'; beforeEach(waitForAsync(() => { diff --git a/src/app/pages/office/cat-a-mod2/components/safety-and-balance/__tests__/safety-and-balance.cat-a-mod2.spec.ts b/src/app/pages/office/cat-a-mod2/components/safety-and-balance/__tests__/safety-and-balance.cat-a-mod2.spec.ts index 2a603db23b..1c12699021 100644 --- a/src/app/pages/office/cat-a-mod2/components/safety-and-balance/__tests__/safety-and-balance.cat-a-mod2.spec.ts +++ b/src/app/pages/office/cat-a-mod2/components/safety-and-balance/__tests__/safety-and-balance.cat-a-mod2.spec.ts @@ -92,13 +92,13 @@ describe('SafetyAndBalanceCardCatAMod2Component', () => { expect(safetyAndBalanceQuestions.length).toBe(3); expect(safetyAndBalanceQuestions[0].nativeElement.innerHTML.trim()).toContain( - (englishTranslations).debrief.safetyAndBalanceQuestions.M4 + englishTranslations.debrief.safetyAndBalanceQuestions.M4 ); expect(safetyAndBalanceQuestions[1].nativeElement.innerHTML.trim()).toContain( - (englishTranslations).debrief.safetyAndBalanceQuestions.M6 + englishTranslations.debrief.safetyAndBalanceQuestions.M6 ); expect(safetyAndBalanceQuestions[2].nativeElement.innerHTML.trim()).toContain( - (englishTranslations).debrief.safetyAndBalanceQuestions.B1 + englishTranslations.debrief.safetyAndBalanceQuestions.B1 ); }); @@ -112,13 +112,13 @@ describe('SafetyAndBalanceCardCatAMod2Component', () => { const safetyAndBalanceQuestions = fixture.debugElement.queryAll(By.css('.counter-label')); expect(safetyAndBalanceQuestions[0].nativeElement.innerHTML.trim()).toContain( - (welshTranslations).debrief.safetyAndBalanceQuestions.M4 + welshTranslations.debrief.safetyAndBalanceQuestions.M4 ); expect(safetyAndBalanceQuestions[1].nativeElement.innerHTML.trim()).toContain( - (welshTranslations).debrief.safetyAndBalanceQuestions.M6 + welshTranslations.debrief.safetyAndBalanceQuestions.M6 ); expect(safetyAndBalanceQuestions[2].nativeElement.innerHTML.trim()).toContain( - (welshTranslations).debrief.safetyAndBalanceQuestions.B1 + welshTranslations.debrief.safetyAndBalanceQuestions.B1 ); done(); }); diff --git a/src/app/pages/pass-certificates/__tests__/pass-certificates.analytics.effects.spec.ts b/src/app/pages/pass-certificates/__tests__/pass-certificates.analytics.effects.spec.ts index 1b1214111c..955d039dbf 100644 --- a/src/app/pages/pass-certificates/__tests__/pass-certificates.analytics.effects.spec.ts +++ b/src/app/pages/pass-certificates/__tests__/pass-certificates.analytics.effects.spec.ts @@ -1,5 +1,6 @@ import { TestBed } from '@angular/core/testing'; import { provideMockActions } from '@ngrx/effects/testing'; +import { Action } from '@ngrx/store'; import { PassCertificatedViewDidEnter } from '@pages/pass-certificates/pass-certificates.actions'; import { PassCertificatesAnalyticsEffects } from '@pages/pass-certificates/pass-certificates.analytics.effects'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; @@ -11,7 +12,7 @@ import { ReplaySubject } from 'rxjs'; describe('PassCertificatesAnalyticsEffects', () => { let effects: PassCertificatesAnalyticsEffects; let analyticsProvider: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; beforeEach(() => { TestBed.configureTestingModule({ diff --git a/src/app/pages/pass-finalisation/__tests__/pass-finalisation.analytics.effects.spec.ts b/src/app/pages/pass-finalisation/__tests__/pass-finalisation.analytics.effects.spec.ts index bf8f93bbd7..1b1c4ddb24 100644 --- a/src/app/pages/pass-finalisation/__tests__/pass-finalisation.analytics.effects.spec.ts +++ b/src/app/pages/pass-finalisation/__tests__/pass-finalisation.analytics.effects.spec.ts @@ -2,7 +2,7 @@ import { TestBed, waitForAsync } from '@angular/core/testing'; import { Router } from '@angular/router'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { CAT_B } from '@pages/page-names.constants'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsProvider } from '@providers/analytics/analytics'; @@ -38,7 +38,7 @@ import { PassFinalisationAnalyticsEffects } from '../pass-finalisation.analytics describe('PassFinalisationAnalyticsEffects', () => { let effects: PassFinalisationAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let store$: Store; const screenName = AnalyticsScreenNames.PASS_FINALISATION; diff --git a/src/app/pages/post-debrief-holding/__tests__/post-debrief-holding.analytics.spec.ts b/src/app/pages/post-debrief-holding/__tests__/post-debrief-holding.analytics.spec.ts index 7074d9435f..89925d02ba 100644 --- a/src/app/pages/post-debrief-holding/__tests__/post-debrief-holding.analytics.spec.ts +++ b/src/app/pages/post-debrief-holding/__tests__/post-debrief-holding.analytics.spec.ts @@ -1,7 +1,7 @@ import { TestBed } from '@angular/core/testing'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule, Action } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; diff --git a/src/app/pages/rekey-reason/__tests__/rekey-reason.analytics.effects.spec.ts b/src/app/pages/rekey-reason/__tests__/rekey-reason.analytics.effects.spec.ts index cc06b91eef..23bb6d326b 100644 --- a/src/app/pages/rekey-reason/__tests__/rekey-reason.analytics.effects.spec.ts +++ b/src/app/pages/rekey-reason/__tests__/rekey-reason.analytics.effects.spec.ts @@ -1,7 +1,7 @@ import { TestBed } from '@angular/core/testing'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule, Action } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { ReplaySubject } from 'rxjs'; import * as fakeJournalActions from '@pages/fake-journal/fake-journal.actions'; diff --git a/src/app/pages/rekey-reason/__tests__/rekey-reason.effects.spec.ts b/src/app/pages/rekey-reason/__tests__/rekey-reason.effects.spec.ts index da523559a2..a07553fbc7 100644 --- a/src/app/pages/rekey-reason/__tests__/rekey-reason.effects.spec.ts +++ b/src/app/pages/rekey-reason/__tests__/rekey-reason.effects.spec.ts @@ -2,7 +2,7 @@ import { HttpErrorResponse, HttpResponse, HttpStatusCode } from '@angular/common import { TestBed } from '@angular/core/testing'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule, Action } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { FindUserProviderMock } from '@providers/find-user/__mocks__/find-user.mock'; import { FindUserProvider } from '@providers/find-user/find-user'; import { StoreModel } from '@shared/models/store.model'; diff --git a/src/app/pages/rekey-reason/__tests__/rekey-reason.page.spec.ts b/src/app/pages/rekey-reason/__tests__/rekey-reason.page.spec.ts index 9e57d09b15..74b1da0aca 100644 --- a/src/app/pages/rekey-reason/__tests__/rekey-reason.page.spec.ts +++ b/src/app/pages/rekey-reason/__tests__/rekey-reason.page.spec.ts @@ -320,7 +320,7 @@ describe('RekeyReasonPage', () => { }); describe('ionViewWillEnter', () => { it('should setup subscription if merged is present', () => { - component.merged$ = new Observable(); + component.merged$ = new Observable>(); component.ionViewWillEnter(); expect(component.subscription).toBeDefined(); diff --git a/src/app/pages/rekey-reason/rekey-reason.page.ts b/src/app/pages/rekey-reason/rekey-reason.page.ts index 9cd1d278f3..caebe9c45c 100644 --- a/src/app/pages/rekey-reason/rekey-reason.page.ts +++ b/src/app/pages/rekey-reason/rekey-reason.page.ts @@ -84,7 +84,7 @@ export class RekeyReasonPage extends BasePageComponent implements OnInit { examinerConducted: number = null; examinerKeyed: number = null; fromRekeySearch = false; - merged$: Observable; + merged$: Observable>; constructor( public store$: Store, diff --git a/src/app/pages/rekey-search/__tests__/rekey-search.analytics.effects.spec.ts b/src/app/pages/rekey-search/__tests__/rekey-search.analytics.effects.spec.ts index 3b29fc997c..c4b3a2d8c9 100644 --- a/src/app/pages/rekey-search/__tests__/rekey-search.analytics.effects.spec.ts +++ b/src/app/pages/rekey-search/__tests__/rekey-search.analytics.effects.spec.ts @@ -1,5 +1,6 @@ import { TestBed, waitForAsync } from '@angular/core/testing'; import { provideMockActions } from '@ngrx/effects/testing'; +import { Action } from '@ngrx/store'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; @@ -11,7 +12,7 @@ import { RekeySearchAnalyticsEffects } from '../rekey-search.analytics.effects'; describe('RekeySearchAnalyticsEffects', () => { let effects: RekeySearchAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; const screenName = AnalyticsScreenNames.REKEY_SEARCH; beforeEach(waitForAsync(() => { diff --git a/src/app/pages/rekey-search/__tests__/rekey-search.effects.spec.ts b/src/app/pages/rekey-search/__tests__/rekey-search.effects.spec.ts index c5671c0a4a..bd9c363263 100644 --- a/src/app/pages/rekey-search/__tests__/rekey-search.effects.spec.ts +++ b/src/app/pages/rekey-search/__tests__/rekey-search.effects.spec.ts @@ -1,7 +1,7 @@ import { HttpErrorResponse, HttpStatusCode } from '@angular/common/http'; import { TestBed, waitForAsync } from '@angular/core/testing'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { ReplaySubject, defer } from 'rxjs'; import { TestSlot } from '@dvsa/mes-journal-schema'; @@ -16,13 +16,13 @@ import * as rekeySearchActions from '../rekey-search.actions'; import { RekeySearchEffects } from '../rekey-search.effects'; import { rekeySearchReducer } from '../rekey-search.reducer'; -function asyncError(errorObject: any) { +function asyncError(errorObject: Error) { return defer(() => Promise.reject(errorObject)); } describe('RekeySearchEffects', () => { let effects: RekeySearchEffects; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let rekeySearchProvider: RekeySearchProvider; let compressionProvider: CompressionProvider; let testSearchProvider: SearchProvider; diff --git a/src/app/pages/rekey-upload-outcome/__tests__/rekey-upload-outcome.analytics.effects.spec.ts b/src/app/pages/rekey-upload-outcome/__tests__/rekey-upload-outcome.analytics.effects.spec.ts index 21f822940c..2536885e51 100644 --- a/src/app/pages/rekey-upload-outcome/__tests__/rekey-upload-outcome.analytics.effects.spec.ts +++ b/src/app/pages/rekey-upload-outcome/__tests__/rekey-upload-outcome.analytics.effects.spec.ts @@ -1,7 +1,7 @@ import { TestBed, waitForAsync } from '@angular/core/testing'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule, Action } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import * as fakeJournalActions from '@pages/fake-journal/fake-journal.actions'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsProvider } from '@providers/analytics/analytics'; diff --git a/src/app/pages/test-centre-journal/__tests__/test-centre-journal.analytics.effects.spec.ts b/src/app/pages/test-centre-journal/__tests__/test-centre-journal.analytics.effects.spec.ts index 241ed18749..8745a7738b 100644 --- a/src/app/pages/test-centre-journal/__tests__/test-centre-journal.analytics.effects.spec.ts +++ b/src/app/pages/test-centre-journal/__tests__/test-centre-journal.analytics.effects.spec.ts @@ -13,13 +13,14 @@ import { JournalRefreshModes, } from '@providers/analytics/analytics.model'; +import { Action } from '@ngrx/store'; import { TestCentreJournalAnalyticsEffects } from '@pages/test-centre-journal/test-centre-journal.analytics.effects'; import * as testCentreJournalActions from '../test-centre-journal.actions'; describe('TestCentreJournalAnalyticsEffects', () => { let effects: TestCentreJournalAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; const screenName = AnalyticsScreenNames.TEST_CENTRE_JOURNAL; beforeEach(() => { diff --git a/src/app/pages/test-centre-journal/__tests__/test-centre-journal.page.spec.ts b/src/app/pages/test-centre-journal/__tests__/test-centre-journal.page.spec.ts index 7547787486..946a1d27f3 100644 --- a/src/app/pages/test-centre-journal/__tests__/test-centre-journal.page.spec.ts +++ b/src/app/pages/test-centre-journal/__tests__/test-centre-journal.page.spec.ts @@ -162,8 +162,8 @@ describe('TestCenterJournalPage', () => { describe('getTestCentreData', () => { beforeEach(() => { spyOn(store$, 'dispatch'); - spyOn(component, 'setOfflineError'); - spyOn(component, 'mapError'); + spyOn(component, 'setOfflineError'); + spyOn(component, 'mapError'); spyOn(logHelper, 'createLog'); spyOn(loadingController, 'create').and.callThrough(); component.isOffline = false; diff --git a/src/app/pages/test-centre-journal/test-centre-journal.page.ts b/src/app/pages/test-centre-journal/test-centre-journal.page.ts index 5db9f96177..3a8fc53786 100644 --- a/src/app/pages/test-centre-journal/test-centre-journal.page.ts +++ b/src/app/pages/test-centre-journal/test-centre-journal.page.ts @@ -180,12 +180,12 @@ export class TestCentreJournalPage extends BasePageComponent implements OnDestro ); }; - private mapError = (error: string): void => { + mapError = (error: string): void => { if (error === undefined || error === '') return; this.errorMessage = error; }; - private setOfflineError = (): void => { + setOfflineError = (): void => { this.didError = true; this.testCentreResults = null; this.showSearchSpinner = false; diff --git a/src/app/pages/test-report-dashboard/__tests__/test-report-dashboard.analytics.effects.spec.ts b/src/app/pages/test-report-dashboard/__tests__/test-report-dashboard.analytics.effects.spec.ts index ca6fe1a0a3..cf02395cbc 100644 --- a/src/app/pages/test-report-dashboard/__tests__/test-report-dashboard.analytics.effects.spec.ts +++ b/src/app/pages/test-report-dashboard/__tests__/test-report-dashboard.analytics.effects.spec.ts @@ -14,7 +14,7 @@ import { } from '@providers/analytics/analytics.model'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import * as fakeJournalActions from '@pages/fake-journal/fake-journal.actions'; import { DASHBOARD_PAGE } from '@pages/page-names.constants'; import { TestReportDashboardAnalyticsEffects } from '@pages/test-report-dashboard/test-report-dashboard.analytics.effects'; @@ -34,7 +34,7 @@ import { TestReportDashboardModalOpened, TestReportDashboardNavigateToPage } fro describe('TestReportDashboardAnalyticsEffects', () => { let effects: TestReportDashboardAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let store$: Store; beforeEach(() => { diff --git a/src/app/pages/test-report/__tests__/test-report.analytics.effects.spec.ts b/src/app/pages/test-report/__tests__/test-report.analytics.effects.spec.ts index b9040fae04..2ab70481b6 100644 --- a/src/app/pages/test-report/__tests__/test-report.analytics.effects.spec.ts +++ b/src/app/pages/test-report/__tests__/test-report.analytics.effects.spec.ts @@ -2,7 +2,7 @@ import { TestBed } from '@angular/core/testing'; import * as testReportAdi3Actions from '@app/pages/test-report/cat-adi-part3/test-report.cat-adi-part3.actions'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { ValidFaultTypes } from '@pages/office/components/fault-comment/fault-comment'; import { testReportReducer } from '@pages/test-report/test-report.reducer'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; @@ -73,7 +73,7 @@ import { TestReportAnalyticsEffects } from '../test-report.analytics.effects'; describe('TestReportAnalyticsEffects', () => { let effects: TestReportAnalyticsEffects; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let analyticsProviderMock: AnalyticsProvider; let store$: Store; let appConfigProvider: AppConfigProvider; diff --git a/src/app/pages/test-report/__tests__/test-report.effects.spec.ts b/src/app/pages/test-report/__tests__/test-report.effects.spec.ts index 1561e774bc..c65634e808 100644 --- a/src/app/pages/test-report/__tests__/test-report.effects.spec.ts +++ b/src/app/pages/test-report/__tests__/test-report.effects.spec.ts @@ -1,7 +1,7 @@ import { TestBed, waitForAsync } from '@angular/core/testing'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { FaultCountProvider } from '@providers/fault-count/fault-count'; import { TestResultProvider } from '@providers/test-result/test-result'; import { ActivityCodes } from '@shared/models/activity-codes'; @@ -18,7 +18,7 @@ import { TestReportEffects } from '../test-report.effects'; describe('TestReportEffects', () => { let effects: TestReportEffects; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let testResultProvider: TestResultProvider; let store$: Store; diff --git a/src/app/pages/test-report/cat-a-mod1/components/speed-check/speed-check.ts b/src/app/pages/test-report/cat-a-mod1/components/speed-check/speed-check.ts index 672a6fa63e..16c73138d9 100644 --- a/src/app/pages/test-report/cat-a-mod1/components/speed-check/speed-check.ts +++ b/src/app/pages/test-report/cat-a-mod1/components/speed-check/speed-check.ts @@ -118,7 +118,7 @@ export class SpeedCheckComponent { return this.secondAttempt || null; }; - onFirstAttemptChange = (attemptedSpeed: any): void => { + onFirstAttemptChange = (attemptedSpeed: { target: { value: string } }): void => { const firstAttempt = this.formatSpeedAttempt(attemptedSpeed); if (this.competency === Competencies.speedCheckEmergency) { @@ -130,7 +130,7 @@ export class SpeedCheckComponent { } }; - onSecondAttemptChange = (attemptedSpeed: any): void => { + onSecondAttemptChange = (attemptedSpeed: { target: { value: string } }): void => { const secondAttempt = this.formatSpeedAttempt(attemptedSpeed); if (this.competency === Competencies.speedCheckEmergency) { @@ -142,12 +142,13 @@ export class SpeedCheckComponent { } }; - formatSpeedAttempt = (event: any): number | undefined => { - if (event.target.value === '') return undefined; - if (typeof event.target.value === 'string' && !this.speedCheckValidator.pattern.test(event.target.value)) { - event.target.value = event.target.value.replace(nonNumericValues, ''); + formatSpeedAttempt = (event: { target: { value: string } }): number | undefined => { + const input = event.target as HTMLInputElement; + if (input.value === '') return undefined; + if (typeof input.value === 'string' && !this.speedCheckValidator.pattern.test(input.value)) { + input.value = input.value.replace(nonNumericValues, ''); } - return Number(event.target.value); + return Number(input.value); }; getNotMet(): boolean { diff --git a/src/app/pages/test-report/cat-adi-part2/components/manoeuvre-competency/manoeuvre-competency.ts b/src/app/pages/test-report/cat-adi-part2/components/manoeuvre-competency/manoeuvre-competency.ts index 0b30eba46d..d68e5a379c 100644 --- a/src/app/pages/test-report/cat-adi-part2/components/manoeuvre-competency/manoeuvre-competency.ts +++ b/src/app/pages/test-report/cat-adi-part2/components/manoeuvre-competency/manoeuvre-competency.ts @@ -197,12 +197,12 @@ export class ManoeuvreCompetencyComponentAdiPart2 implements OnInit, OnDestroy { * Manages the addition and removal of the ripple effect animation css class * @returns any */ - applyRippleEffect = (): any => { + applyRippleEffect = (): void => { this.rippleState = true; this.rippleTimeout = setTimeout(() => this.removeRippleEffect(), this.rippleEffectAnimationDuration); }; - removeRippleEffect = (): any => { + removeRippleEffect = (): void => { this.rippleState = false; clearTimeout(this.rippleTimeout); }; diff --git a/src/app/pages/test-report/cat-manoeuvre/components/reverse-manoeuvre/reverse-manoeuvre.ts b/src/app/pages/test-report/cat-manoeuvre/components/reverse-manoeuvre/reverse-manoeuvre.ts index 6ddc1119b5..6621f0d4cd 100644 --- a/src/app/pages/test-report/cat-manoeuvre/components/reverse-manoeuvre/reverse-manoeuvre.ts +++ b/src/app/pages/test-report/cat-manoeuvre/components/reverse-manoeuvre/reverse-manoeuvre.ts @@ -193,12 +193,12 @@ export class ReverseManoeuvreComponent { * Manages the addition and removal of the ripple effect animation css class * @returns any */ - applyRippleEffect = (): any => { + applyRippleEffect = (): void => { this.rippleState = true; this.rippleTimeout = setTimeout(() => this.removeRippleEffect(), this.rippleEffectAnimationDuration); }; - removeRippleEffect = (): any => { + removeRippleEffect = (): void => { this.rippleState = false; clearTimeout(this.rippleTimeout); }; diff --git a/src/app/pages/test-report/components/competency-button/competency-button.ts b/src/app/pages/test-report/components/competency-button/competency-button.ts index b10a332312..1852779e54 100644 --- a/src/app/pages/test-report/components/competency-button/competency-button.ts +++ b/src/app/pages/test-report/components/competency-button/competency-button.ts @@ -49,12 +49,12 @@ export class CompetencyButtonComponent { } } - applyRippleEffect = (): any => { + applyRippleEffect = (): void => { this.rippleState = true; this.rippleTimeout = setTimeout(() => this.removeRippleEffect(), this.rippleEffectAnimationDuration); }; - removeRippleEffect = (): any => { + removeRippleEffect = (): void => { this.rippleState = false; clearTimeout(this.rippleTimeout); }; diff --git a/src/app/pages/test-report/components/manoeuvre-competency/manoeuvre-competency.ts b/src/app/pages/test-report/components/manoeuvre-competency/manoeuvre-competency.ts index 2dde1e90e1..22ec252a2c 100644 --- a/src/app/pages/test-report/components/manoeuvre-competency/manoeuvre-competency.ts +++ b/src/app/pages/test-report/components/manoeuvre-competency/manoeuvre-competency.ts @@ -204,12 +204,12 @@ export class ManoeuvreCompetencyComponent implements OnInit, OnDestroy { * Manages the addition and removal of the ripple effect animation css class * @returns any */ - applyRippleEffect = (): any => { + applyRippleEffect = (): void => { this.rippleState = true; this.rippleTimeout = setTimeout(() => this.removeRippleEffect(), this.rippleEffectAnimationDuration); }; - removeRippleEffect = (): any => { + removeRippleEffect = (): void => { this.rippleState = false; clearTimeout(this.rippleTimeout); }; diff --git a/src/app/pages/test-report/components/reverse-diagram-modal/__tests__/reverse-diagram-modal.analytics.effects.spec.ts b/src/app/pages/test-report/components/reverse-diagram-modal/__tests__/reverse-diagram-modal.analytics.effects.spec.ts index e37e67047d..42a3a10195 100644 --- a/src/app/pages/test-report/components/reverse-diagram-modal/__tests__/reverse-diagram-modal.analytics.effects.spec.ts +++ b/src/app/pages/test-report/components/reverse-diagram-modal/__tests__/reverse-diagram-modal.analytics.effects.spec.ts @@ -2,7 +2,7 @@ import { TestBed } from '@angular/core/testing'; import { Application } from '@dvsa/mes-journal-schema'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import * as fakeJournalActions from '@pages/fake-journal/fake-journal.actions'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsProvider } from '@providers/analytics/analytics'; @@ -30,7 +30,7 @@ import { ReverseDiagramModalAnalyticsEffects } from '../reverse-diagram-modal.an describe('ReverseDiagramModalAnalyticsEffects', () => { let effects: ReverseDiagramModalAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let store$: Store; const screenName = AnalyticsScreenNames.REVERSE_DIAGRAM; const mockApplication: Application = { diff --git a/src/app/pages/test-results-search/__tests__/test-results-search.analytics.effects.spec.ts b/src/app/pages/test-results-search/__tests__/test-results-search.analytics.effects.spec.ts index 2fea0f0143..254d75ca0e 100644 --- a/src/app/pages/test-results-search/__tests__/test-results-search.analytics.effects.spec.ts +++ b/src/app/pages/test-results-search/__tests__/test-results-search.analytics.effects.spec.ts @@ -2,6 +2,7 @@ import { TestBed } from '@angular/core/testing'; import { provideMockActions } from '@ngrx/effects/testing'; import { ReplaySubject } from 'rxjs'; +import { Action } from '@ngrx/store'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; @@ -18,7 +19,7 @@ import { TestResultsSearchAnalyticsEffects } from '../test-results-search.analyt describe('TestResultsSearchAnalyticsEffects', () => { let effects: TestResultsSearchAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; const screenName = AnalyticsScreenNames.TEST_RESULTS_SEARCH; beforeEach(() => { diff --git a/src/app/pages/test-results-search/components/advanced-search/__tests__/advanced-search.spec.ts b/src/app/pages/test-results-search/components/advanced-search/__tests__/advanced-search.spec.ts index 120d1df37d..711e1ee1bc 100644 --- a/src/app/pages/test-results-search/components/advanced-search/__tests__/advanced-search.spec.ts +++ b/src/app/pages/test-results-search/components/advanced-search/__tests__/advanced-search.spec.ts @@ -34,7 +34,7 @@ describe('AdvancedSearchComponent', () => { }); describe('upperCaseAlphaNum', () => { - const testItem: any = { + const testItem: Event = { target: { value: '12!abC', }, diff --git a/src/app/pages/unuploaded-tests/__tests__/unuploaded-tests.analytics.effects.spec.ts b/src/app/pages/unuploaded-tests/__tests__/unuploaded-tests.analytics.effects.spec.ts index 9ea1e3c6d2..d592962fd3 100644 --- a/src/app/pages/unuploaded-tests/__tests__/unuploaded-tests.analytics.effects.spec.ts +++ b/src/app/pages/unuploaded-tests/__tests__/unuploaded-tests.analytics.effects.spec.ts @@ -1,5 +1,6 @@ import { TestBed, waitForAsync } from '@angular/core/testing'; import { provideMockActions } from '@ngrx/effects/testing'; +import { Action } from '@ngrx/store'; import { ContinueUnuploadedTest, UnuploadedTestsViewDidEnter } from '@pages/unuploaded-tests/unuploaded-tests.actions'; import { UnuploadedTestsAnalyticsEffects } from '@pages/unuploaded-tests/unuploaded-tests.analytics.effects'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; @@ -16,7 +17,7 @@ import { ReplaySubject } from 'rxjs'; describe('UnuploadedTestsAnalyticsEffects', () => { let effects: UnuploadedTestsAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; const screenName = AnalyticsScreenNames.UN_UPLOADED; beforeEach(waitForAsync(() => { diff --git a/src/app/pages/view-test-result/__tests__/view-test-results.analytics.effects.spec.ts b/src/app/pages/view-test-result/__tests__/view-test-results.analytics.effects.spec.ts index 2cbfd8bbf8..a0b83a8f7d 100644 --- a/src/app/pages/view-test-result/__tests__/view-test-results.analytics.effects.spec.ts +++ b/src/app/pages/view-test-result/__tests__/view-test-results.analytics.effects.spec.ts @@ -1,5 +1,6 @@ import { TestBed } from '@angular/core/testing'; import { provideMockActions } from '@ngrx/effects/testing'; +import { Action } from '@ngrx/store'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; @@ -11,7 +12,7 @@ import { ViewTestResultAnalyticsEffects } from '../view-test-result.analytics.ef describe('ViewTestResultAnalyticsEffects', () => { let effects: ViewTestResultAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; const screenName = AnalyticsScreenNames.VIEW_TEST_RESULT; beforeEach(() => { diff --git a/src/app/pages/view-test-result/view-test-result.page.ts b/src/app/pages/view-test-result/view-test-result.page.ts index c38f1ec7b9..60f37dc592 100644 --- a/src/app/pages/view-test-result/view-test-result.page.ts +++ b/src/app/pages/view-test-result/view-test-result.page.ts @@ -1,5 +1,6 @@ import { HttpResponse } from '@angular/common/http'; import { ChangeDetectorRef, Component, Injector, Input, OnInit } from '@angular/core'; +import { SearchResultTestSchema } from '@dvsa/mes-search-schema'; import { TestResultSchemasUnion } from '@dvsa/mes-test-schema/categories'; import { CatADI2UniqueTypes } from '@dvsa/mes-test-schema/categories/ADI2'; import { @@ -87,7 +88,7 @@ export class ViewTestResultPage extends BasePageComponent implements OnInit { this.subscription = this.searchProvider .getTestResult(this.applicationReference, this.authenticationProvider.getEmployeeId()) .pipe( - map((response: HttpResponse): string => response.body), + map((response: HttpResponse): SearchResultTestSchema => response.body), map((data) => (this.testResult = this.compressionProvider.extract(data))), tap(async () => this.handleLoadingUI(false)), catchError(async (err) => { diff --git a/src/app/pages/waiting-room-to-car/__tests__/waiting-room-to-car.analytics.effects.spec.ts b/src/app/pages/waiting-room-to-car/__tests__/waiting-room-to-car.analytics.effects.spec.ts index 2c17d2048d..8d294d893c 100644 --- a/src/app/pages/waiting-room-to-car/__tests__/waiting-room-to-car.analytics.effects.spec.ts +++ b/src/app/pages/waiting-room-to-car/__tests__/waiting-room-to-car.analytics.effects.spec.ts @@ -3,7 +3,7 @@ import { Router } from '@angular/router'; import { Application } from '@dvsa/mes-journal-schema'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { CAT_B } from '@pages/page-names.constants'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsProvider } from '@providers/analytics/analytics'; @@ -40,7 +40,7 @@ import { WaitingRoomToCarAnalyticsEffects } from '../waiting-room-to-car.analyti describe('WaitingRoomToCarAnalyticsEffects', () => { let effects: WaitingRoomToCarAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let store$: Store; const screenName = AnalyticsScreenNames.WAITING_ROOM_TO_CAR; const mockApplication: Application = { diff --git a/src/app/pages/waiting-room-to-car/cat-a-mod2/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-a-mod2.analytics.effects.spec.ts b/src/app/pages/waiting-room-to-car/cat-a-mod2/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-a-mod2.analytics.effects.spec.ts index e987e0cf17..a419557878 100644 --- a/src/app/pages/waiting-room-to-car/cat-a-mod2/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-a-mod2.analytics.effects.spec.ts +++ b/src/app/pages/waiting-room-to-car/cat-a-mod2/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-a-mod2.analytics.effects.spec.ts @@ -2,7 +2,7 @@ import { TestBed } from '@angular/core/testing'; import { QuestionOutcome, QuestionResult } from '@dvsa/mes-test-schema/categories/common'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import * as fakeJournalActions from '@pages/fake-journal/fake-journal.actions'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsProvider } from '@providers/analytics/analytics'; @@ -26,7 +26,7 @@ import { VehicleChecksModalCatAMod2AnalyticsEffects } from '../vehicle-checks-mo describe('VehicleChecksModalCatAMod2AnalyticsEffects', () => { let effects: VehicleChecksModalCatAMod2AnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let store$: Store; const screenName = AnalyticsScreenNames.VEHICLE_CHECKS; diff --git a/src/app/pages/waiting-room-to-car/cat-adi-part2/components/trainer-registration-number/trainer-registration-number.cat-adi-part2.ts b/src/app/pages/waiting-room-to-car/cat-adi-part2/components/trainer-registration-number/trainer-registration-number.cat-adi-part2.ts index 8f9f1312b2..2416a39fbf 100644 --- a/src/app/pages/waiting-room-to-car/cat-adi-part2/components/trainer-registration-number/trainer-registration-number.cat-adi-part2.ts +++ b/src/app/pages/waiting-room-to-car/cat-adi-part2/components/trainer-registration-number/trainer-registration-number.cat-adi-part2.ts @@ -33,14 +33,12 @@ export class TrainerRegistrationNumberCatAdiPart2Component implements OnChanges this.formControl.patchValue(this.trainerRegistration); } - trainerRegistrationChanged(event: any): void { - if ( - typeof event.target.value === 'string' && - !this.trainerRegistrationNumberValidator.pattern.test(event.target.value) - ) { - event.target.value = event.target.value.replace(leadingZero, '').replace(nonNumericValues, ''); + trainerRegistrationChanged(event: Event): void { + const input = event.target as HTMLInputElement; + if (typeof input.value === 'string' && !this.trainerRegistrationNumberValidator.pattern.test(input.value)) { + input.value = input.value.replace(leadingZero, '').replace(nonNumericValues, ''); } - this.trainerRegistrationChange.emit(Number(event.target.value) || undefined); + this.trainerRegistrationChange.emit(Number(input.value) || undefined); } get invalid(): boolean { diff --git a/src/app/pages/waiting-room-to-car/cat-adi-part2/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-adi-part2.analytics.effects.spec.ts b/src/app/pages/waiting-room-to-car/cat-adi-part2/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-adi-part2.analytics.effects.spec.ts index 355373e5cd..bb8ac79615 100644 --- a/src/app/pages/waiting-room-to-car/cat-adi-part2/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-adi-part2.analytics.effects.spec.ts +++ b/src/app/pages/waiting-room-to-car/cat-adi-part2/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-adi-part2.analytics.effects.spec.ts @@ -2,7 +2,7 @@ import { TestBed } from '@angular/core/testing'; import { QuestionOutcome, QuestionResult } from '@dvsa/mes-test-schema/categories/common'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import * as fakeJournalActions from '@pages/fake-journal/fake-journal.actions'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsProvider } from '@providers/analytics/analytics'; @@ -26,7 +26,7 @@ import { VehicleChecksModalAnalyticsEffects } from '../vehicle-checks-modal.cat- describe('VehicleChecksModalAnalyticsEffects', () => { let effects: VehicleChecksModalAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let store$: Store; const screenName = AnalyticsScreenNames.VEHICLE_CHECKS; diff --git a/src/app/pages/waiting-room-to-car/cat-b/components/instructor-registration/__tests__/instructor-registration.spec.ts b/src/app/pages/waiting-room-to-car/cat-b/components/instructor-registration/__tests__/instructor-registration.spec.ts index 8f321de1b6..0b5af347d4 100644 --- a/src/app/pages/waiting-room-to-car/cat-b/components/instructor-registration/__tests__/instructor-registration.spec.ts +++ b/src/app/pages/waiting-room-to-car/cat-b/components/instructor-registration/__tests__/instructor-registration.spec.ts @@ -71,27 +71,27 @@ describe('InstructorRegistrationComponent', () => { }); it('should recognise a valid numeric string and emit the value as a number', () => { - component.instructorRegistrationChanged(mockValidInstructorRegistrationNumber); + component.instructorRegistrationChanged(mockValidInstructorRegistrationNumber.target.value); expect(component.instructorRegistrationChange.emit).toHaveBeenCalledWith(1234567); }); it('should remove non-numeric characters and emit the value as number', () => { - component.instructorRegistrationChanged(mockInvalidInstructorRegistrationNumber); + component.instructorRegistrationChanged(mockInvalidInstructorRegistrationNumber.target.value); expect(component.instructorRegistrationChange.emit).toHaveBeenCalledWith(12457); }); it('should remove preceding zeros and emit rest of valid result', () => { - component.instructorRegistrationChanged(mockLeadingZeroRegistrationNumber); + component.instructorRegistrationChanged(mockLeadingZeroRegistrationNumber.target.value); expect(component.instructorRegistrationChange.emit).toHaveBeenCalledWith(4567); }); it('should remove preceding zeros and emit undefined as empty', () => { - component.instructorRegistrationChanged(mockOnlyZeroRegistrationNumber); + component.instructorRegistrationChanged(mockOnlyZeroRegistrationNumber.target.value); expect(component.instructorRegistrationChange.emit).toHaveBeenCalledWith(undefined); }); it('should emit undefined as the value can`t be cast to a number', () => { - component.instructorRegistrationChanged(mockBlankInstructorRegistrationNumber); + component.instructorRegistrationChanged(mockBlankInstructorRegistrationNumber.target.value); expect(component.instructorRegistrationChange.emit).toHaveBeenCalledWith(undefined); }); }); diff --git a/src/app/pages/waiting-room-to-car/cat-b/components/instructor-registration/instructor-registration.html b/src/app/pages/waiting-room-to-car/cat-b/components/instructor-registration/instructor-registration.html index 09d707658c..5d11124ee4 100644 --- a/src/app/pages/waiting-room-to-car/cat-b/components/instructor-registration/instructor-registration.html +++ b/src/app/pages/waiting-room-to-car/cat-b/components/instructor-registration/instructor-registration.html @@ -15,7 +15,7 @@ class="ion-input-styling increase-width" formControlName="instructorRegistration" [maxlength]="instructorRegistrationNumberValidator.maxLength" - (ionChange)="instructorRegistrationChanged($event)" + (ionChange)="instructorRegistrationChanged($event.target.value)" > diff --git a/src/app/pages/waiting-room-to-car/cat-b/components/instructor-registration/instructor-registration.ts b/src/app/pages/waiting-room-to-car/cat-b/components/instructor-registration/instructor-registration.ts index c2b71b9c8a..c4e00bc615 100644 --- a/src/app/pages/waiting-room-to-car/cat-b/components/instructor-registration/instructor-registration.ts +++ b/src/app/pages/waiting-room-to-car/cat-b/components/instructor-registration/instructor-registration.ts @@ -33,14 +33,11 @@ export class InstructorRegistrationComponent implements OnChanges { this.formControl.patchValue(this.instructorRegistration); } - instructorRegistrationChanged(event: any): void { - if ( - typeof event.target.value === 'string' && - !this.instructorRegistrationNumberValidator.pattern.test(event.target.value) - ) { - event.target.value = event.target.value.replace(leadingZero, '').replace(nonNumericValues, ''); + instructorRegistrationChanged(value: string): void { + if (typeof value === 'string' && !this.instructorRegistrationNumberValidator.pattern.test(value)) { + value = value.replace(leadingZero, '').replace(nonNumericValues, ''); } - this.instructorRegistrationChange.emit(Number(event.target.value) || undefined); + this.instructorRegistrationChange.emit(Number(value) || undefined); } get invalid(): boolean { diff --git a/src/app/pages/waiting-room-to-car/cat-d/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-d.analytics.effects.spec.ts b/src/app/pages/waiting-room-to-car/cat-d/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-d.analytics.effects.spec.ts index 644a52e60b..0c9218ed2a 100644 --- a/src/app/pages/waiting-room-to-car/cat-d/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-d.analytics.effects.spec.ts +++ b/src/app/pages/waiting-room-to-car/cat-d/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-d.analytics.effects.spec.ts @@ -1,7 +1,7 @@ import { TestBed } from '@angular/core/testing'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; @@ -28,7 +28,7 @@ import { VehicleChecksModalCatDAnalyticsEffects } from '../vehicle-checks-modal. describe('VehicleChecksModalCatDAnalyticsEffects', () => { let effects: VehicleChecksModalCatDAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let store$: Store; const screenName = AnalyticsScreenNames.VEHICLE_CHECKS; diff --git a/src/app/pages/waiting-room-to-car/cat-home-test/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-home.analytics.effects.spec.ts b/src/app/pages/waiting-room-to-car/cat-home-test/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-home.analytics.effects.spec.ts index fccfecd11b..3620d30ea3 100644 --- a/src/app/pages/waiting-room-to-car/cat-home-test/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-home.analytics.effects.spec.ts +++ b/src/app/pages/waiting-room-to-car/cat-home-test/components/vehicle-checks-modal/__tests__/vehicle-checks-modal.cat-home.analytics.effects.spec.ts @@ -1,7 +1,7 @@ import { TestBed } from '@angular/core/testing'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; @@ -26,7 +26,7 @@ import { VehicleChecksViewDidEnter } from '../vehicle-checks-modal.cat-home.acti describe('VehicleChecksModalCatHomeTestAnalyticsEffects', () => { let effects: VehicleChecksModalCatHomeTestAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let store$: Store; const screenName = AnalyticsScreenNames.VEHICLE_CHECKS; diff --git a/src/app/pages/waiting-room-to-car/components/mot-components/mot-failed-modal/__tests__/mot-failed-modal.component.spec.ts b/src/app/pages/waiting-room-to-car/components/mot-components/mot-failed-modal/__tests__/mot-failed-modal.component.spec.ts index 2d714ed72d..8838fb248c 100644 --- a/src/app/pages/waiting-room-to-car/components/mot-components/mot-failed-modal/__tests__/mot-failed-modal.component.spec.ts +++ b/src/app/pages/waiting-room-to-car/components/mot-components/mot-failed-modal/__tests__/mot-failed-modal.component.spec.ts @@ -51,12 +51,12 @@ describe('MotFailedModal', () => { describe('vehicleRegistrationChanged', () => { it('should set vehicleRegistration to an uppercase version of the data inputted into the modal', () => { component.vehicleRegistration = ''; - component.vehicleRegistrationChanged({ target: { value: 'string' } }); + component.vehicleRegistrationChanged('string'); expect(component.vehicleRegistration).toEqual('STRING'); }); it('should remove all non alphanumeric characters from the passed parameter', () => { component.vehicleRegistration = ''; - component.vehicleRegistrationChanged({ target: { value: '!s!t!r!i!n!g!' } }); + component.vehicleRegistrationChanged('!s!t!r!i!n!g!'); expect(component.vehicleRegistration).toEqual('STRING'); }); }); diff --git a/src/app/pages/waiting-room-to-car/components/mot-components/mot-failed-modal/mot-failed-modal.component.html b/src/app/pages/waiting-room-to-car/components/mot-components/mot-failed-modal/mot-failed-modal.component.html index 252136bd5b..8c97d63102 100644 --- a/src/app/pages/waiting-room-to-car/components/mot-components/mot-failed-modal/mot-failed-modal.component.html +++ b/src/app/pages/waiting-room-to-car/components/mot-components/mot-failed-modal/mot-failed-modal.component.html @@ -19,7 +19,7 @@ aria-labelledby="vehicle-registration-number-title" formControlName="vehicleRegistration" class="ion-input-styling" - (ionChange)="vehicleRegistrationChanged($event)" + (ionChange)="vehicleRegistrationChanged($event.target.value)" [class.ng-invalid]="invalid" [maxlength]="registrationNumberValidator.maxLength" > diff --git a/src/app/pages/waiting-room-to-car/components/mot-components/mot-failed-modal/mot-failed-modal.component.ts b/src/app/pages/waiting-room-to-car/components/mot-components/mot-failed-modal/mot-failed-modal.component.ts index 227da74ed7..f9bd34d49e 100644 --- a/src/app/pages/waiting-room-to-car/components/mot-components/mot-failed-modal/mot-failed-modal.component.ts +++ b/src/app/pages/waiting-room-to-car/components/mot-components/mot-failed-modal/mot-failed-modal.component.ts @@ -47,15 +47,15 @@ export class MotFailedModal implements OnInit { return !this.formControl.valid && this.formControl.dirty; } - vehicleRegistrationChanged(event: any): void { - if (typeof event.target.value === 'string' && !this.registrationNumberValidator.pattern.test(event.target.value)) { - event.target.value = event.target.value?.replace(nonAlphaNumericValues, ''); + vehicleRegistrationChanged(value: string): void { + if (typeof value === 'string' && !this.registrationNumberValidator.pattern.test(value)) { + value = value?.replace(nonAlphaNumericValues, ''); - if (isEmpty(event.target.value)) { - this.formControl.setErrors({ invalidValue: event.target.value }); + if (isEmpty(value)) { + this.formControl.setErrors({ invalidValue: value }); } } - this.vehicleRegistration = event.target.value?.toUpperCase(); + this.vehicleRegistration = value?.toUpperCase(); } async onConfirm() { diff --git a/src/app/pages/waiting-room-to-car/components/vehicle-registration/vehicle-registration.ts b/src/app/pages/waiting-room-to-car/components/vehicle-registration/vehicle-registration.ts index 70bbf0a5fd..1e666fe09d 100644 --- a/src/app/pages/waiting-room-to-car/components/vehicle-registration/vehicle-registration.ts +++ b/src/app/pages/waiting-room-to-car/components/vehicle-registration/vehicle-registration.ts @@ -246,20 +246,16 @@ export class VehicleRegistrationComponent implements OnChanges { * * @param {any} event - The input event containing the new value for the vehicle registration field. */ - registrationInput(event: any): void { - this.clearData(); - if (this.isSearchingForMOT) { - this.abortMOTCall(MOTAbortedMethod.VRN_CHANGED); - } - this.hasCalledMOT = false; - if (typeof event.target.value === 'string' && !this.registrationNumberValidator.pattern.test(event.target.value)) { - event.target.value = event.target.value?.replace(nonAlphaNumericValues, ''); + registrationInput(event: Event): void { + const input = event.target as HTMLInputElement; + if (typeof input.value === 'string' && !this.registrationNumberValidator.pattern.test(input.value)) { + input.value = input.value.replace(nonAlphaNumericValues, ''); - if (isEmpty(event.target.value)) { - this.formControl.setErrors({ invalidValue: event.target.value }); + if (isEmpty(input.value)) { + this.formControl.setErrors({ invalidValue: input.value }); } } - this.vehicleRegistration = event.target.value?.toUpperCase(); + this.vehicleRegistration = input.value.toUpperCase(); } isMOTNotValid() { diff --git a/src/app/pages/waiting-room/__tests__/waiting-room.analytics.effects.spec.ts b/src/app/pages/waiting-room/__tests__/waiting-room.analytics.effects.spec.ts index e63c95a65a..9b6cd2f533 100644 --- a/src/app/pages/waiting-room/__tests__/waiting-room.analytics.effects.spec.ts +++ b/src/app/pages/waiting-room/__tests__/waiting-room.analytics.effects.spec.ts @@ -3,7 +3,7 @@ import { Router } from '@angular/router'; import { Application } from '@dvsa/mes-journal-schema'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import * as fakeJournalActions from '@pages/fake-journal/fake-journal.actions'; import { TestFlowPageNames } from '@pages/page-names.constants'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; @@ -30,7 +30,7 @@ import { WaitingRoomAnalyticsEffects } from '../waiting-room.analytics.effects'; describe('WaitingRoomAnalyticsEffects', () => { let effects: WaitingRoomAnalyticsEffects; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let store$: Store; const mockApplication: Application = { applicationId: 123456, diff --git a/src/app/providers/authentication/__tests__/authentication.spec.ts b/src/app/providers/authentication/__tests__/authentication.spec.ts index 004deae017..99ecddd8d1 100644 --- a/src/app/providers/authentication/__tests__/authentication.spec.ts +++ b/src/app/providers/authentication/__tests__/authentication.spec.ts @@ -65,7 +65,7 @@ describe('AuthenticationProvider', () => { describe('Provider', () => { beforeEach(() => { - spyOn(authenticationProvider as unknown, 'logEvent'); + spyOn(authenticationProvider, 'logEvent'); }); it('should compile', () => { expect(authenticationProvider).toBeDefined(); diff --git a/src/app/providers/data-store/__tests__/data-store.spec.ts b/src/app/providers/data-store/__tests__/data-store.spec.ts index 5eb114a08b..6db86ad0e6 100644 --- a/src/app/providers/data-store/__tests__/data-store.spec.ts +++ b/src/app/providers/data-store/__tests__/data-store.spec.ts @@ -181,7 +181,7 @@ describe('DataStoreProvider', () => { iosVersion: '1.0.0', deviceId: 'fb455c20-c025-4d6b-bbf2-aab80af6efb8', drivingExaminerId: 'testData', - } as Log, + } as unknown as Log, }) ); }); diff --git a/src/app/providers/delegated-rekey-search/mock-data/delegated-mock-data.ts b/src/app/providers/delegated-rekey-search/mock-data/delegated-mock-data.ts index c2978097ab..61ec87c9e1 100644 --- a/src/app/providers/delegated-rekey-search/mock-data/delegated-mock-data.ts +++ b/src/app/providers/delegated-rekey-search/mock-data/delegated-mock-data.ts @@ -4,7 +4,7 @@ export interface DelegatedExaminerTestSlot extends TestSlot { examinerId: number; } -export function mockGetDelegatedBooking(): any { +export function mockGetDelegatedBooking(): unknown { return { examinerId: 4583912, testSlot: { diff --git a/src/app/providers/device-authentication/__tests__/device-authentication.spec.ts b/src/app/providers/device-authentication/__tests__/device-authentication.spec.ts index 1ac5aefdd8..cdd92f21fc 100644 --- a/src/app/providers/device-authentication/__tests__/device-authentication.spec.ts +++ b/src/app/providers/device-authentication/__tests__/device-authentication.spec.ts @@ -26,7 +26,7 @@ describe('DeviceAuthenticationProvider', () => { TestBed.configureTestingModule({ providers: [ DeviceAuthenticationProvider, - { provide: Store, useClass: MockStore }, + {provide: Store, useClass: MockStore}, provideMockStore({}), { provide: LogHelper, @@ -58,14 +58,21 @@ describe('DeviceAuthenticationProvider', () => { spyOn(loadingProvider, 'handleUILoading').and.returnValue(Promise.resolve()); spyOn(platform, 'ready').and.returnValue(Promise.resolve('')); spyOn(platform, 'is').and.returnValue(true); - spyOn(deviceAuthenticationProvider.appConfig, 'getAppConfig').and.returnValue({ role: 'DE' } as AppConfig); + spyOn(deviceAuthenticationProvider.appConfig, 'getAppConfig').and.returnValue({role: 'DE'} as AppConfig); (environment as unknown as TestersEnvironmentFile).isTest = false; spyOn(NativeBiometricMock, 'isAvailable'); - (NativeBiometricMock.isAvailable) - .withArgs({ key: 'useFallback' }) - .and.returnValue(Promise.resolve({ value: { available: true } })); + // (NativeBiometricMock.isAvailable) + // .withArgs({ key: 'useFallback' }) + // .and.returnValue(Promise.resolve({ value: { available: true } })); + + spyOn(NativeBiometricMock, 'isAvailable').and.callFake((args) => { + if (args.useFallback) { + return Promise.resolve({ biometryType: 'fingerprint', isAvailable: true }); + } + return Promise.resolve({value: {available: false}}); + }); }); describe('triggerLockScreen', () => { diff --git a/src/app/providers/device/device.ts b/src/app/providers/device/device.ts index 187dd8d523..997c4a6095 100644 --- a/src/app/providers/device/device.ts +++ b/src/app/providers/device/device.ts @@ -121,7 +121,7 @@ export class DeviceProvider { ); }; - private logEvent = (desc: string, err: any) => { + private logEvent = (desc: string, err: string) => { this.store$.dispatch( SaveLog({ payload: this.logHelper.createLog(LogType.ERROR, desc, err), diff --git a/src/app/providers/fault-count/__tests__/fault-count.spec.ts b/src/app/providers/fault-count/__tests__/fault-count.spec.ts index abc9de0403..cc9d4bd449 100644 --- a/src/app/providers/fault-count/__tests__/fault-count.spec.ts +++ b/src/app/providers/fault-count/__tests__/fault-count.spec.ts @@ -109,67 +109,67 @@ describe('FaultCountProvider', () => { describe('CAT ADI2', () => { it('shoud call the category ADI2 specific method for getting the riding fault sum count', () => { faultCountProvider.getDrivingFaultSumCount(TestCategory.ADI2, catADI2TestDataStateObjectNoDrivingFaults); - expect((FaultCountADIPart2Helper as any).getDrivingFaultSumCountCatADIPart2).toHaveBeenCalled(); + expect(FaultCountADIPart2Helper.getDrivingFaultSumCountCatADIPart2).toHaveBeenCalled(); }); }); describe('CAT A', () => { it('shoud call the category AM1 specific method for getting the riding fault sum count', () => { faultCountProvider.getDrivingFaultSumCount(TestCategory.EUAM1, catAM1TestDataStateObject); - expect((FaultCountAM1Helper as any).getRidingFaultSumCountCatAM1).toHaveBeenCalled(); + expect(FaultCountAM1Helper.getRidingFaultSumCountCatAM1).toHaveBeenCalled(); }); it('shoud call the category AM2 specific method for getting the riding fault sum count', () => { faultCountProvider.getDrivingFaultSumCount(TestCategory.EUAM2, catAM2TestDataStateObject); - expect((FaultCountAM2Helper as any).getRidingFaultSumCountCatAM2).toHaveBeenCalled(); + expect(FaultCountAM2Helper.getRidingFaultSumCountCatAM2).toHaveBeenCalled(); }); }); describe('CAT B', () => { it('should call the category B specific method for getting the driving fault sum count', () => { faultCountProvider.getDrivingFaultSumCount(TestCategory.B, catBTestDataStateObject); - expect((FaultCountBHelper as any).getDrivingFaultSumCountCatB).toHaveBeenCalled(); + expect(FaultCountBHelper.getDrivingFaultSumCountCatB).toHaveBeenCalled(); }); it('should call the category BE specific method for getting the driving fault sum count', () => { faultCountProvider.getDrivingFaultSumCount(TestCategory.BE, catBETestDataStateObject); - expect((FaultCountBEHelper as any).getDrivingFaultSumCountCatBE).toHaveBeenCalled(); + expect(FaultCountBEHelper.getDrivingFaultSumCountCatBE).toHaveBeenCalled(); }); }); describe('CAT C', () => { it('should call the category C specific method for getting the driving fault sum count', () => { faultCountProvider.getDrivingFaultSumCount(TestCategory.C, catCTestDataStateObject); - expect((FaultCountCHelper as any).getDrivingFaultSumCountCatC).toHaveBeenCalled(); + expect(FaultCountCHelper.getDrivingFaultSumCountCatC).toHaveBeenCalled(); }); it('should call the category CE specific method for getting the driving fault sum count', () => { faultCountProvider.getDrivingFaultSumCount(TestCategory.CE, catCETestDataStateObject); - expect((FaultCountCHelper as any).getDrivingFaultSumCountCatCE).toHaveBeenCalled(); + expect(FaultCountCHelper.getDrivingFaultSumCountCatCE).toHaveBeenCalled(); }); it('should call the category C1E specific method for getting the driving fault sum count', () => { faultCountProvider.getDrivingFaultSumCount(TestCategory.C1E, catC1ETestDataStateObject); - expect((FaultCountCHelper as any).getDrivingFaultSumCountCatC1E).toHaveBeenCalled(); + expect(FaultCountCHelper.getDrivingFaultSumCountCatC1E).toHaveBeenCalled(); }); it('should call the category C1 specific method for getting the driving fault sum count', () => { faultCountProvider.getDrivingFaultSumCount(TestCategory.C1, catC1TestDataStateObject); - expect((FaultCountCHelper as any).getDrivingFaultSumCountCatC1).toHaveBeenCalled(); + expect(FaultCountCHelper.getDrivingFaultSumCountCatC1).toHaveBeenCalled(); }); }); describe('CAT D', () => { it('should call the category D specific method for getting the driving fault sum count', () => { faultCountProvider.getDrivingFaultSumCount(TestCategory.D, catDTestDataStateObject); - expect((FaultCountDHelper as any).getDrivingFaultSumCountCatD).toHaveBeenCalled(); + expect(FaultCountDHelper.getDrivingFaultSumCountCatD).toHaveBeenCalled(); }); it('should call the category DE specific method for getting the driving fault sum count', () => { faultCountProvider.getDrivingFaultSumCount(TestCategory.DE, catDETestDataStateObject); - expect((FaultCountDHelper as any).getDrivingFaultSumCountCatDE).toHaveBeenCalled(); + expect(FaultCountDHelper.getDrivingFaultSumCountCatDE).toHaveBeenCalled(); }); it('should call the category D1E specific method for getting the driving fault sum count', () => { faultCountProvider.getDrivingFaultSumCount(TestCategory.D1E, catD1ETestDataStateObject); - expect((FaultCountDHelper as any).getDrivingFaultSumCountCatD1E).toHaveBeenCalled(); + expect(FaultCountDHelper.getDrivingFaultSumCountCatD1E).toHaveBeenCalled(); }); it('should call the category D1 specific method for getting the driving fault sum count', () => { faultCountProvider.getDrivingFaultSumCount(TestCategory.D1, catD1TestDataStateObject); - expect((FaultCountDHelper as any).getDrivingFaultSumCountCatD1).toHaveBeenCalled(); + expect(FaultCountDHelper.getDrivingFaultSumCountCatD1).toHaveBeenCalled(); }); }); @@ -206,7 +206,7 @@ describe('FaultCountProvider', () => { TestCategory.D1EM, ].forEach((category) => { faultCountProvider.getSeriousFaultSumCount(category, catManoeuvreTestDataStateObject); - expect((FaultCountManoeuvreTestHelper as any).getSeriousFaultSumCountManoeuvreTest).toHaveBeenCalled(); + expect(FaultCountManoeuvreTestHelper.getSeriousFaultSumCountManoeuvreTest).toHaveBeenCalled(); }); }); @@ -219,67 +219,67 @@ describe('FaultCountProvider', () => { describe('CAT ADI2', () => { it('shoud call the category ADI2 specific method for getting the riding fault sum count', () => { faultCountProvider.getSeriousFaultSumCount(TestCategory.ADI2, catADI2TestDataStateObjectNoDrivingFaults); - expect((FaultCountADIPart2Helper as any).getSeriousFaultSumCountCatADIPart2).toHaveBeenCalled(); + expect(FaultCountADIPart2Helper.getSeriousFaultSumCountCatADIPart2).toHaveBeenCalled(); }); }); describe('CAT A', () => { it('should call the category AM1 specific method for getting the serious fault sum count', () => { faultCountProvider.getSeriousFaultSumCount(TestCategory.EUAM1, catAM1TestDataStateObject); - expect((FaultCountAM1Helper as any).getSeriousFaultSumCountCatAM1).toHaveBeenCalled(); + expect(FaultCountAM1Helper.getSeriousFaultSumCountCatAM1).toHaveBeenCalled(); }); it('should call the category AM2 specific method for getting the serious fault sum count', () => { faultCountProvider.getSeriousFaultSumCount(TestCategory.EUAM2, catAM2TestDataStateObject); - expect((FaultCountAM2Helper as any).getSeriousFaultSumCountCatAM2).toHaveBeenCalled(); + expect(FaultCountAM2Helper.getSeriousFaultSumCountCatAM2).toHaveBeenCalled(); }); }); describe('CAT B', () => { it('should call the category B specific method for getting the serious fault sum count', () => { faultCountProvider.getSeriousFaultSumCount(TestCategory.B, catBTestDataStateObject); - expect((FaultCountBHelper as any).getSeriousFaultSumCountCatB).toHaveBeenCalled(); + expect(FaultCountBHelper.getSeriousFaultSumCountCatB).toHaveBeenCalled(); }); it('should call the category BE specific method for getting the serious fault sum count', () => { faultCountProvider.getSeriousFaultSumCount(TestCategory.BE, catBETestDataStateObject); - expect((FaultCountBEHelper as any).getSeriousFaultSumCountCatBE).toHaveBeenCalled(); + expect(FaultCountBEHelper.getSeriousFaultSumCountCatBE).toHaveBeenCalled(); }); }); describe('CAT C', () => { it('should call the category C specific method for getting the serious fault sum count', () => { faultCountProvider.getSeriousFaultSumCount(TestCategory.C, catCTestDataStateObject); - expect((FaultCountCHelper as any).getSeriousFaultSumCountCatC).toHaveBeenCalled(); + expect(FaultCountCHelper.getSeriousFaultSumCountCatC).toHaveBeenCalled(); }); it('should call the category CE specific method for getting the serious fault sum count', () => { faultCountProvider.getSeriousFaultSumCount(TestCategory.CE, catCETestDataStateObject); - expect((FaultCountCHelper as any).getSeriousFaultSumCountCatCE).toHaveBeenCalled(); + expect(FaultCountCHelper.getSeriousFaultSumCountCatCE).toHaveBeenCalled(); }); it('should call the category C1 specific method for getting the serious fault sum count', () => { faultCountProvider.getSeriousFaultSumCount(TestCategory.C1, catC1TestDataStateObject); - expect((FaultCountCHelper as any).getSeriousFaultSumCountCatC1).toHaveBeenCalled(); + expect(FaultCountCHelper.getSeriousFaultSumCountCatC1).toHaveBeenCalled(); }); it('should call the category C1E specific method for getting the serious fault sum count', () => { faultCountProvider.getSeriousFaultSumCount(TestCategory.C1E, catC1ETestDataStateObject); - expect((FaultCountCHelper as any).getSeriousFaultSumCountCatC1E).toHaveBeenCalled(); + expect(FaultCountCHelper.getSeriousFaultSumCountCatC1E).toHaveBeenCalled(); }); }); describe('CAT D', () => { it('should call the category D specific method for getting the serious fault sum count', () => { faultCountProvider.getSeriousFaultSumCount(TestCategory.D, catDTestDataStateObject); - expect((FaultCountDHelper as any).getSeriousFaultSumCountCatD).toHaveBeenCalled(); + expect(FaultCountDHelper.getSeriousFaultSumCountCatD).toHaveBeenCalled(); }); it('should call the category DE specific method for getting the serious fault sum count', () => { faultCountProvider.getSeriousFaultSumCount(TestCategory.DE, catDETestDataStateObject); - expect((FaultCountDHelper as any).getSeriousFaultSumCountCatDE).toHaveBeenCalled(); + expect(FaultCountDHelper.getSeriousFaultSumCountCatDE).toHaveBeenCalled(); }); it('should call the category D1 specific method for getting the serious fault sum count', () => { faultCountProvider.getSeriousFaultSumCount(TestCategory.D1, catD1TestDataStateObject); - expect((FaultCountDHelper as any).getSeriousFaultSumCountCatD1).toHaveBeenCalled(); + expect(FaultCountDHelper.getSeriousFaultSumCountCatD1).toHaveBeenCalled(); }); it('should call the category D1E specific method for getting the serious fault sum count', () => { faultCountProvider.getSeriousFaultSumCount(TestCategory.D1E, catD1ETestDataStateObject); - expect((FaultCountDHelper as any).getSeriousFaultSumCountCatD1E).toHaveBeenCalled(); + expect(FaultCountDHelper.getSeriousFaultSumCountCatD1E).toHaveBeenCalled(); }); }); }); @@ -297,7 +297,7 @@ describe('FaultCountProvider', () => { TestCategory.D1EM, ].forEach((category) => { faultCountProvider.getDangerousFaultSumCount(category, catManoeuvreTestDataStateObject); - expect((FaultCountManoeuvreTestHelper as any).getDangerousFaultSumCountManoeuvreTest).toHaveBeenCalled(); + expect(FaultCountManoeuvreTestHelper.getDangerousFaultSumCountManoeuvreTest).toHaveBeenCalled(); }); }); @@ -310,140 +310,140 @@ describe('FaultCountProvider', () => { describe('CAT ADI2', () => { it('shoud call the category ADI2 specific method for getting the riding fault sum count', () => { faultCountProvider.getDangerousFaultSumCount(TestCategory.ADI2, catADI2TestDataStateObjectNoDrivingFaults); - expect((FaultCountADIPart2Helper as any).getDangerousFaultSumCountCatADIPart2).toHaveBeenCalled(); + expect(FaultCountADIPart2Helper.getDangerousFaultSumCountCatADIPart2).toHaveBeenCalled(); }); }); describe('CAT A', () => { it('should call the category AM1 specific method for getting the dangerous fault sum count', () => { faultCountProvider.getDangerousFaultSumCount(TestCategory.EUAM1, catAM1TestDataStateObject); - expect((FaultCountAM1Helper as any).getDangerousFaultSumCountCatAM1).toHaveBeenCalled(); + expect(FaultCountAM1Helper.getDangerousFaultSumCountCatAM1).toHaveBeenCalled(); }); it('should call the category AM2 specific method for getting the dangerous fault sum count', () => { faultCountProvider.getDangerousFaultSumCount(TestCategory.EUAM2, catAM2TestDataStateObject); - expect((FaultCountAM2Helper as any).getDangerousFaultSumCountCatAM2).toHaveBeenCalled(); + expect(FaultCountAM2Helper.getDangerousFaultSumCountCatAM2).toHaveBeenCalled(); }); }); describe('CAT B', () => { it('should call the category B specific method for getting the dangerous fault sum count', () => { faultCountProvider.getDangerousFaultSumCount(TestCategory.B, catBTestDataStateObject); - expect((FaultCountBHelper as any).getDangerousFaultSumCountCatB).toHaveBeenCalled(); + expect(FaultCountBHelper.getDangerousFaultSumCountCatB).toHaveBeenCalled(); }); it('should call the category BE specific method for getting the dangerous fault sum count', () => { faultCountProvider.getDangerousFaultSumCount(TestCategory.BE, catBETestDataStateObject); - expect((FaultCountBEHelper as any).getDangerousFaultSumCountCatBE).toHaveBeenCalled(); + expect(FaultCountBEHelper.getDangerousFaultSumCountCatBE).toHaveBeenCalled(); }); }); describe('CAT C', () => { it('should call the category C specific method for getting the dangerous fault sum count', () => { faultCountProvider.getDangerousFaultSumCount(TestCategory.C, catCTestDataStateObject); - expect((FaultCountCHelper as any).getDangerousFaultSumCountCatC).toHaveBeenCalled(); + expect(FaultCountCHelper.getDangerousFaultSumCountCatC).toHaveBeenCalled(); }); it('should call the category C1 specific method for getting the dangerous fault sum count', () => { faultCountProvider.getDangerousFaultSumCount(TestCategory.C1, catC1TestDataStateObject); - expect((FaultCountCHelper as any).getDangerousFaultSumCountCatC1).toHaveBeenCalled(); + expect(FaultCountCHelper.getDangerousFaultSumCountCatC1).toHaveBeenCalled(); }); it('should call the category CE specific method for getting the dangerous fault sum count', () => { faultCountProvider.getDangerousFaultSumCount(TestCategory.CE, catCETestDataStateObject); - expect((FaultCountCHelper as any).getDangerousFaultSumCountCatCE).toHaveBeenCalled(); + expect(FaultCountCHelper.getDangerousFaultSumCountCatCE).toHaveBeenCalled(); }); it('should call the category C1E specific method for getting the dangerous fault sum count', () => { faultCountProvider.getDangerousFaultSumCount(TestCategory.C1E, catC1ETestDataStateObject); - expect((FaultCountCHelper as any).getDangerousFaultSumCountCatC1E).toHaveBeenCalled(); + expect(FaultCountCHelper.getDangerousFaultSumCountCatC1E).toHaveBeenCalled(); }); }); describe('CAT D', () => { it('should call the category D specific method for getting the dangerous fault sum count', () => { faultCountProvider.getDangerousFaultSumCount(TestCategory.D, catDTestDataStateObject); - expect((FaultCountDHelper as any).getDangerousFaultSumCountCatD).toHaveBeenCalled(); + expect(FaultCountDHelper.getDangerousFaultSumCountCatD).toHaveBeenCalled(); }); it('should call the category D1 specific method for getting the dangerous fault sum count', () => { faultCountProvider.getDangerousFaultSumCount(TestCategory.D1, catD1TestDataStateObject); - expect((FaultCountDHelper as any).getDangerousFaultSumCountCatD1).toHaveBeenCalled(); + expect(FaultCountDHelper.getDangerousFaultSumCountCatD1).toHaveBeenCalled(); }); it('should call the category DE specific method for getting the dangerous fault sum count', () => { faultCountProvider.getDangerousFaultSumCount(TestCategory.DE, catDETestDataStateObject); - expect((FaultCountDHelper as any).getDangerousFaultSumCountCatDE).toHaveBeenCalled(); + expect(FaultCountDHelper.getDangerousFaultSumCountCatDE).toHaveBeenCalled(); }); it('should call the category D1E specific method for getting the dangerous fault sum count', () => { faultCountProvider.getDangerousFaultSumCount(TestCategory.D1E, catD1ETestDataStateObject); - expect((FaultCountDHelper as any).getDangerousFaultSumCountCatD1E).toHaveBeenCalled(); + expect(FaultCountDHelper.getDangerousFaultSumCountCatD1E).toHaveBeenCalled(); }); }); }); describe('getDrivingFaultSumCountCatB', () => { it('should return the driving fault for cat B count correctly', () => { - expect((FaultCountBHelper as any).getDrivingFaultSumCountCatB(catBTestDataStateObject)).toBe(4); + expect(FaultCountBHelper.getDrivingFaultSumCountCatB(catBTestDataStateObject)).toBe(4); }); }); describe('getDrivingFaultSumCountCatBE', () => { it('should return the driving fault for cat BE count correctly', () => { - expect((FaultCountBEHelper as any).getDrivingFaultSumCountCatBE(catBETestDataStateObject)).toBe(5); + expect(FaultCountBEHelper.getDrivingFaultSumCountCatBE(catBETestDataStateObject)).toBe(5); }); }); describe('getDrivingFaultSumCountCatC', () => { it('should return the driving fault for cat C count correctly', () => { - expect((FaultCountCHelper as any).getDrivingFaultSumCountCatC(catCTestDataStateObject)).toBe(5); + expect(FaultCountCHelper.getDrivingFaultSumCountCatC(catCTestDataStateObject)).toBe(5); }); }); describe('getDrivingFaultSumCountCatC1', () => { it('should return the driving fault for cat C1 count correctly', () => { - expect((FaultCountCHelper as any).getDrivingFaultSumCountCatC1(catC1TestDataStateObject)).toBe(5); + expect(FaultCountCHelper.getDrivingFaultSumCountCatC1(catC1TestDataStateObject)).toBe(5); }); }); describe('getDrivingFaultSumCountCatCE', () => { it('should return the driving fault for cat CE count correctly', () => { - expect((FaultCountCHelper as any).getDrivingFaultSumCountCatCE(catCETestDataStateObject)).toBe(5); + expect(FaultCountCHelper.getDrivingFaultSumCountCatCE(catCETestDataStateObject)).toBe(5); }); }); describe('getDrivingFaultSumCountCatC1E', () => { it('should return the driving fault for cat C1E count correctly', () => { - expect((FaultCountCHelper as any).getDrivingFaultSumCountCatC1E(catC1ETestDataStateObject)).toBe(5); + expect(FaultCountCHelper.getDrivingFaultSumCountCatC1E(catC1ETestDataStateObject)).toBe(5); }); }); describe('getRidingFaultSumCountCatAM1', () => { it('should return the driving fault for cat AM1 count correctly', () => { - expect((FaultCountAM1Helper as any).getRidingFaultSumCountCatAM1(catAM1TestDataStateObject)).toBe(5); + expect(FaultCountAM1Helper.getRidingFaultSumCountCatAM1(catAM1TestDataStateObject)).toBe(5); }); }); describe('getDrivingFaultSumCountCatD', () => { it('should return the driving fault for cat D count correctly', () => { - expect((FaultCountDHelper as any).getDrivingFaultSumCountCatD(catDTestDataStateObject)).toBe(6); + expect(FaultCountDHelper.getDrivingFaultSumCountCatD(catDTestDataStateObject)).toBe(6); }); }); describe('getDrivingFaultSumCountCatD1', () => { it('should return the driving fault for cat D1 count correctly', () => { - expect((FaultCountDHelper as any).getDrivingFaultSumCountCatD1(catD1TestDataStateObject)).toBe(6); + expect(FaultCountDHelper.getDrivingFaultSumCountCatD1(catD1TestDataStateObject)).toBe(6); }); }); describe('getDrivingFaultSumCountCatDE', () => { it('should return the driving fault for cat DE count correctly', () => { - expect((FaultCountDHelper as any).getDrivingFaultSumCountCatDE(catDETestDataStateObject)).toBe(6); + expect(FaultCountDHelper.getDrivingFaultSumCountCatDE(catDETestDataStateObject)).toBe(6); }); }); describe('getDrivingFaultSumCountCatD1E', () => { it('should return the driving fault for cat D1E count correctly', () => { - expect((FaultCountDHelper as any).getDrivingFaultSumCountCatD1E(catD1ETestDataStateObject)).toBe(6); + expect(FaultCountDHelper.getDrivingFaultSumCountCatD1E(catD1ETestDataStateObject)).toBe(6); }); }); describe('getSeriousFaultSumCountCatB', () => { it('should return the serious faults count', () => { - expect((FaultCountBHelper as any).getSeriousFaultSumCountCatB(catBTestDataStateObject)).toBe(1); + expect(FaultCountBHelper.getSeriousFaultSumCountCatB(catBTestDataStateObject)).toBe(1); }); it('should return the correct count of serious faults', () => { const failedState: CatBUniqueTypes.TestData = { @@ -471,13 +471,13 @@ describe('FaultCountProvider', () => { seriousFault: true, }, }; - expect((FaultCountBHelper as any).getSeriousFaultSumCountCatB(failedState)).toBe(5); + expect(FaultCountBHelper.getSeriousFaultSumCountCatB(failedState)).toBe(5); }); }); describe('getDangerousFaultSumCountCatB', () => { it('should return the dangerous faults count', () => { - expect((FaultCountBHelper as any).getDangerousFaultSumCountCatB(catBTestDataStateObject)).toBe(1); + expect(FaultCountBHelper.getDangerousFaultSumCountCatB(catBTestDataStateObject)).toBe(1); }); it('should return the correct number of dangerous faults', () => { const failedState: CatBUniqueTypes.TestData = { @@ -501,13 +501,13 @@ describe('FaultCountProvider', () => { }, }, }; - expect((FaultCountBHelper as any).getDangerousFaultSumCountCatB(failedState)).toBe(4); + expect(FaultCountBHelper.getDangerousFaultSumCountCatB(failedState)).toBe(4); }); }); describe('getSeriousFaultSumCountCatBE', () => { it('should return the serious faults count', () => { - expect((FaultCountBEHelper as any).getSeriousFaultSumCountCatBE(catBETestDataStateObject)).toBe(1); + expect(FaultCountBEHelper.getSeriousFaultSumCountCatBE(catBETestDataStateObject)).toBe(1); }); it('should return the correct count of serious faults', () => { const failedState: CatBEUniqueTypes.TestData = { @@ -533,13 +533,13 @@ describe('FaultCountProvider', () => { seriousFault: true, }, }; - expect((FaultCountBEHelper as any).getSeriousFaultSumCountCatBE(failedState)).toBe(2); + expect(FaultCountBEHelper.getSeriousFaultSumCountCatBE(failedState)).toBe(2); }); }); describe('getDangerousFaultSumCountCatBE', () => { it('should return the dangerous faults count', () => { - expect((FaultCountBEHelper as any).getDangerousFaultSumCountCatBE(catBETestDataStateObject)).toBe(1); + expect(FaultCountBEHelper.getDangerousFaultSumCountCatBE(catBETestDataStateObject)).toBe(1); }); it('should return the correct number of dangerous faults', () => { const failedState: CatBEUniqueTypes.TestData = { @@ -561,19 +561,19 @@ describe('FaultCountProvider', () => { ], }, }; - expect((FaultCountBEHelper as any).getDangerousFaultSumCountCatBE(failedState)).toBe(1); + expect(FaultCountBEHelper.getDangerousFaultSumCountCatBE(failedState)).toBe(1); }); }); describe('getDangerousFaultSumCountCatAM1', () => { it('should return the dangerous faults count', () => { - expect((FaultCountAM1Helper as any).getDangerousFaultSumCountCatAM1(catAM1TestDataStateObject)).toBe(5); + expect(FaultCountAM1Helper.getDangerousFaultSumCountCatAM1(catAM1TestDataStateObject)).toBe(5); }); }); describe('getSeriousFaultSumCountCatAM1', () => { it('should return the serious faults count', () => { - expect((FaultCountAM1Helper as any).getSeriousFaultSumCountCatAM1(catAM1TestDataStateObject)).toBe(5); + expect(FaultCountAM1Helper.getSeriousFaultSumCountCatAM1(catAM1TestDataStateObject)).toBe(5); }); }); diff --git a/src/app/providers/fault-count/cat-c/__tests__/fault-count.spec.ts b/src/app/providers/fault-count/cat-c/__tests__/fault-count.spec.ts index dee916e2a0..58b383c356 100644 --- a/src/app/providers/fault-count/cat-c/__tests__/fault-count.spec.ts +++ b/src/app/providers/fault-count/cat-c/__tests__/fault-count.spec.ts @@ -4,61 +4,37 @@ import { FaultCountCHelper } from '../fault-count.cat-c'; describe('FaultCountCHelper', () => { describe('getVehicleChecksFaultCountCatC', () => { it('5 driving faults result in 1 serious and 4 driving faults', () => { - expect((FaultCountCHelper as any).getVehicleChecksFaultCountCatC(vehicleChecksFiveFaults).drivingFaults).toEqual( - 4 - ); - expect((FaultCountCHelper as any).getVehicleChecksFaultCountCatC(vehicleChecksFiveFaults).seriousFaults).toEqual( - 1 - ); + expect(FaultCountCHelper.getVehicleChecksFaultCountCatC(vehicleChecksFiveFaults).drivingFaults).toEqual(4); + expect(FaultCountCHelper.getVehicleChecksFaultCountCatC(vehicleChecksFiveFaults).seriousFaults).toEqual(1); }); it('2 driving faults result in 2 driving faults and no serious', () => { - expect((FaultCountCHelper as any).getVehicleChecksFaultCountCatC(vehicleChecksTwoFaults).drivingFaults).toEqual( - 2 - ); - expect((FaultCountCHelper as any).getVehicleChecksFaultCountCatC(vehicleChecksTwoFaults).seriousFaults).toEqual( - 0 - ); + expect(FaultCountCHelper.getVehicleChecksFaultCountCatC(vehicleChecksTwoFaults).drivingFaults).toEqual(2); + expect(FaultCountCHelper.getVehicleChecksFaultCountCatC(vehicleChecksTwoFaults).seriousFaults).toEqual(0); }); }); describe('getVehicleChecksFaultCountCatC1', () => { it('5 driving faults result in 1 serious and 4 driving faults', () => { - expect((FaultCountCHelper as any).getVehicleChecksFaultCountCatC1(vehicleChecksFiveFaults).drivingFaults).toEqual( - 4 - ); - expect((FaultCountCHelper as any).getVehicleChecksFaultCountCatC1(vehicleChecksFiveFaults).seriousFaults).toEqual( - 1 - ); + expect(FaultCountCHelper.getVehicleChecksFaultCountCatC1(vehicleChecksFiveFaults).drivingFaults).toEqual(4); + expect(FaultCountCHelper.getVehicleChecksFaultCountCatC1(vehicleChecksFiveFaults).seriousFaults).toEqual(1); }); it('2 driving faults result in 2 driving faults and no serious', () => { - expect((FaultCountCHelper as any).getVehicleChecksFaultCountCatC1(vehicleChecksTwoFaults).drivingFaults).toEqual( - 2 - ); - expect((FaultCountCHelper as any).getVehicleChecksFaultCountCatC1(vehicleChecksTwoFaults).seriousFaults).toEqual( - 0 - ); + expect(FaultCountCHelper.getVehicleChecksFaultCountCatC1(vehicleChecksTwoFaults).drivingFaults).toEqual(2); + expect(FaultCountCHelper.getVehicleChecksFaultCountCatC1(vehicleChecksTwoFaults).seriousFaults).toEqual(0); }); }); describe('getVehicleChecksFaultCountCatCE', () => { it('2 driving faults result in 1 driving faults and 1 serious', () => { - expect((FaultCountCHelper as any).getVehicleChecksFaultCountCatCE(vehicleChecksTwoFaults).drivingFaults).toEqual( - 1 - ); - expect((FaultCountCHelper as any).getVehicleChecksFaultCountCatCE(vehicleChecksTwoFaults).seriousFaults).toEqual( - 1 - ); + expect(FaultCountCHelper.getVehicleChecksFaultCountCatCE(vehicleChecksTwoFaults).drivingFaults).toEqual(1); + expect(FaultCountCHelper.getVehicleChecksFaultCountCatCE(vehicleChecksTwoFaults).seriousFaults).toEqual(1); }); }); describe('getVehicleChecksFaultCountCatC1E', () => { it('2 driving faults result in 1 driving faults and 1 serious', () => { - expect((FaultCountCHelper as any).getVehicleChecksFaultCountCatC1E(vehicleChecksTwoFaults).drivingFaults).toEqual( - 1 - ); - expect((FaultCountCHelper as any).getVehicleChecksFaultCountCatC1E(vehicleChecksTwoFaults).seriousFaults).toEqual( - 1 - ); + expect(FaultCountCHelper.getVehicleChecksFaultCountCatC1E(vehicleChecksTwoFaults).drivingFaults).toEqual(1); + expect(FaultCountCHelper.getVehicleChecksFaultCountCatC1E(vehicleChecksTwoFaults).seriousFaults).toEqual(1); }); }); }); diff --git a/src/app/providers/fault-count/cat-d/__tests__/fault-count.spec.ts b/src/app/providers/fault-count/cat-d/__tests__/fault-count.spec.ts index 3796ddcec1..8e0ae9f11b 100644 --- a/src/app/providers/fault-count/cat-d/__tests__/fault-count.spec.ts +++ b/src/app/providers/fault-count/cat-d/__tests__/fault-count.spec.ts @@ -4,61 +4,37 @@ import { FaultCountDHelper } from '../fault-count.cat-d'; describe('FaultCountDHelper', () => { describe('getVehicleChecksFaultCountCatD', () => { it('5 driving faults result in 1 serious and 4 driving faults', () => { - expect((FaultCountDHelper as any).getVehicleChecksFaultCountCatD(vehicleChecksFiveFaults).drivingFaults).toEqual( - 4 - ); - expect((FaultCountDHelper as any).getVehicleChecksFaultCountCatD(vehicleChecksFiveFaults).seriousFaults).toEqual( - 1 - ); + expect(FaultCountDHelper.getVehicleChecksFaultCountCatD(vehicleChecksFiveFaults).drivingFaults).toEqual(4); + expect(FaultCountDHelper.getVehicleChecksFaultCountCatD(vehicleChecksFiveFaults).seriousFaults).toEqual(1); }); it('2 driving faults result in 2 driving faults and no serious', () => { - expect((FaultCountDHelper as any).getVehicleChecksFaultCountCatD(vehicleChecksTwoFaults).drivingFaults).toEqual( - 2 - ); - expect((FaultCountDHelper as any).getVehicleChecksFaultCountCatD(vehicleChecksTwoFaults).seriousFaults).toEqual( - 0 - ); + expect(FaultCountDHelper.getVehicleChecksFaultCountCatD(vehicleChecksTwoFaults).drivingFaults).toEqual(2); + expect(FaultCountDHelper.getVehicleChecksFaultCountCatD(vehicleChecksTwoFaults).seriousFaults).toEqual(0); }); }); describe('getVehicleChecksFaultCountCatD1', () => { it('5 driving faults result in 1 serious and 4 driving faults', () => { - expect((FaultCountDHelper as any).getVehicleChecksFaultCountCatD1(vehicleChecksFiveFaults).drivingFaults).toEqual( - 4 - ); - expect((FaultCountDHelper as any).getVehicleChecksFaultCountCatD1(vehicleChecksFiveFaults).seriousFaults).toEqual( - 1 - ); + expect(FaultCountDHelper.getVehicleChecksFaultCountCatD1(vehicleChecksFiveFaults).drivingFaults).toEqual(4); + expect(FaultCountDHelper.getVehicleChecksFaultCountCatD1(vehicleChecksFiveFaults).seriousFaults).toEqual(1); }); it('2 driving faults result in 2 driving faults and no serious', () => { - expect((FaultCountDHelper as any).getVehicleChecksFaultCountCatD1(vehicleChecksTwoFaults).drivingFaults).toEqual( - 2 - ); - expect((FaultCountDHelper as any).getVehicleChecksFaultCountCatD1(vehicleChecksTwoFaults).seriousFaults).toEqual( - 0 - ); + expect(FaultCountDHelper.getVehicleChecksFaultCountCatD1(vehicleChecksTwoFaults).drivingFaults).toEqual(2); + expect(FaultCountDHelper.getVehicleChecksFaultCountCatD1(vehicleChecksTwoFaults).seriousFaults).toEqual(0); }); }); describe('getVehicleChecksFaultCountCatDE', () => { it('2 driving faults result in 1 driving faults and 1 serious', () => { - expect((FaultCountDHelper as any).getVehicleChecksFaultCountCatDE(vehicleChecksTwoFaults).drivingFaults).toEqual( - 1 - ); - expect((FaultCountDHelper as any).getVehicleChecksFaultCountCatDE(vehicleChecksTwoFaults).seriousFaults).toEqual( - 1 - ); + expect(FaultCountDHelper.getVehicleChecksFaultCountCatDE(vehicleChecksTwoFaults).drivingFaults).toEqual(1); + expect(FaultCountDHelper.getVehicleChecksFaultCountCatDE(vehicleChecksTwoFaults).seriousFaults).toEqual(1); }); }); describe('getVehicleChecksFaultCountCatD1E', () => { it('2 driving faults result in 1 driving faults and 1 serious', () => { - expect((FaultCountDHelper as any).getVehicleChecksFaultCountCatD1E(vehicleChecksTwoFaults).drivingFaults).toEqual( - 1 - ); - expect((FaultCountDHelper as any).getVehicleChecksFaultCountCatD1E(vehicleChecksTwoFaults).seriousFaults).toEqual( - 1 - ); + expect(FaultCountDHelper.getVehicleChecksFaultCountCatD1E(vehicleChecksTwoFaults).drivingFaults).toEqual(1); + expect(FaultCountDHelper.getVehicleChecksFaultCountCatD1E(vehicleChecksTwoFaults).seriousFaults).toEqual(1); }); }); }); diff --git a/src/app/providers/fault-count/cat-home-test/__tests__/fault-count.cat-home-tests.spec.ts b/src/app/providers/fault-count/cat-home-test/__tests__/fault-count.cat-home-tests.spec.ts index 00da5cc186..1777c1f9a9 100644 --- a/src/app/providers/fault-count/cat-home-test/__tests__/fault-count.cat-home-tests.spec.ts +++ b/src/app/providers/fault-count/cat-home-test/__tests__/fault-count.cat-home-tests.spec.ts @@ -188,10 +188,10 @@ describe('FaultCountHomeTestHelper', () => { describe('getVehicleChecksFaultCountCatHomeTest', () => { it('2 driving faults result in 1 driving fault', () => { expect( - (FaultCountHomeTestHelper as any).getVehicleChecksFaultCountCatHomeTest(vehicleChecksTwoFaults).drivingFaults + FaultCountHomeTestHelper.getVehicleChecksFaultCountCatHomeTest(vehicleChecksTwoFaults).drivingFaults ).toEqual(1); expect( - (FaultCountHomeTestHelper as any).getVehicleChecksFaultCountCatHomeTest(vehicleChecksTwoFaults).seriousFaults + FaultCountHomeTestHelper.getVehicleChecksFaultCountCatHomeTest(vehicleChecksTwoFaults).seriousFaults ).toEqual(0); }); }); diff --git a/src/app/providers/mot-history-api/__tests__/mot-history-api.service.spec.ts b/src/app/providers/mot-history-api/__tests__/mot-history-api.service.spec.ts index 55c96d4562..1f0c56d80a 100644 --- a/src/app/providers/mot-history-api/__tests__/mot-history-api.service.spec.ts +++ b/src/app/providers/mot-history-api/__tests__/mot-history-api.service.spec.ts @@ -1,4 +1,4 @@ -import { HttpHeaders, HttpResponse } from '@angular/common/http'; +import { HttpHeaders, HttpResponse, HttpErrorResponse } from '@angular/common/http'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { TestBed } from '@angular/core/testing'; import { PracticeModeMOTType } from '@pages/waiting-room-to-car/components/mot-components/practice-mode-mot-modal/practice-mode-mot-modal.component'; @@ -248,7 +248,7 @@ describe('MotHistoryApiService', () => { describe('handleError', () => { it('should return default response with status and vehicle registration', () => { - const error = { status: 500 }; + const error = new HttpErrorResponse({ error: {}, status: 500 }); vehicleDetailsService.handleError(error, 'ABC123').subscribe((val) => { expect(val).toEqual({ status: '500', @@ -264,7 +264,7 @@ describe('MotHistoryApiService', () => { }); it('should handle error with status 404', () => { - const error = { status: 404 }; + const error = new HttpErrorResponse({ error: {}, status: 404 }); vehicleDetailsService.handleError(error, 'XYZ789').subscribe((val) => { expect(val).toEqual({ status: '404', @@ -280,7 +280,7 @@ describe('MotHistoryApiService', () => { }); it('should handle error with no status', () => { - const error = {}; + const error = new HttpErrorResponse({ error: {}, status: 0 }); vehicleDetailsService.handleError(error, 'NO_STATUS').subscribe((val) => { expect(val).toEqual({ status: undefined, diff --git a/src/app/providers/mot-history-api/mot-history-api.service.ts b/src/app/providers/mot-history-api/mot-history-api.service.ts index 48b090f9c4..057a5b6324 100644 --- a/src/app/providers/mot-history-api/mot-history-api.service.ts +++ b/src/app/providers/mot-history-api/mot-history-api.service.ts @@ -1,4 +1,4 @@ -import {HttpClient, HttpErrorResponse, HttpHeaders, HttpResponse} from '@angular/common/http'; +import { HttpClient, HttpErrorResponse, HttpHeaders, HttpResponse } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { PracticeModeMOTType } from '@pages/waiting-room-to-car/components/mot-components/practice-mode-mot-modal/practice-mode-mot-modal.component'; import { AppConfigProvider } from '@providers/app-config/app-config'; diff --git a/src/app/providers/outcome-behaviour-map/outcome-behaviour-map.ts b/src/app/providers/outcome-behaviour-map/outcome-behaviour-map.ts index fec3c29e81..eec7c6a732 100644 --- a/src/app/providers/outcome-behaviour-map/outcome-behaviour-map.ts +++ b/src/app/providers/outcome-behaviour-map/outcome-behaviour-map.ts @@ -26,7 +26,7 @@ export class OutcomeBehaviourMapProvider { return field.display; } - isVisible(outcomeId: string, fieldName: string, value: any): boolean { + isVisible(outcomeId: string, fieldName: string, value: unknown): boolean { const mappedOutcome = this.behaviourMap[outcomeId]; if (!mappedOutcome) { diff --git a/src/app/providers/rekey-search/__mocks__/rekey-search.mock.ts b/src/app/providers/rekey-search/__mocks__/rekey-search.mock.ts index 1a08de8b46..c261ab2e61 100644 --- a/src/app/providers/rekey-search/__mocks__/rekey-search.mock.ts +++ b/src/app/providers/rekey-search/__mocks__/rekey-search.mock.ts @@ -1,8 +1,8 @@ -import { Observable, of } from 'rxjs'; +import { of } from 'rxjs'; import { bookedTestMockHash } from './booked-test.mock'; export class RekeySearchProviderMock { - getBooking(): Observable { + getBooking() { return of(bookedTestMockHash); } } diff --git a/src/app/providers/search/__mocks__/search.mock.ts b/src/app/providers/search/__mocks__/search.mock.ts index 79c8d557c8..da6fec94a9 100644 --- a/src/app/providers/search/__mocks__/search.mock.ts +++ b/src/app/providers/search/__mocks__/search.mock.ts @@ -11,7 +11,7 @@ export class SearchProviderMock { advancedSearch = jasmine.createSpy('advancedSearch').and.returnValue(of(searchResultsMock)); - getTestResult(): Observable { + getTestResult(): Observable { return of( new HttpResponse({ // eslint-disable-next-line max-len @@ -22,7 +22,7 @@ export class SearchProviderMock { ); } - getTestResults(): Observable { + getTestResults(): Observable { return of( new HttpResponse({ // eslint-disable-next-line max-len diff --git a/src/app/providers/slot-selector/slot-selector.ts b/src/app/providers/slot-selector/slot-selector.ts index 2ac3bb4ab4..0c07c4aec5 100644 --- a/src/app/providers/slot-selector/slot-selector.ts +++ b/src/app/providers/slot-selector/slot-selector.ts @@ -26,7 +26,7 @@ export class SlotSelectorProvider { return !this.checkPropertiesHaveValues((slotData).booking); }; - public checkPropertiesHaveValues = (obj: any): boolean => { + public checkPropertiesHaveValues = (obj: {}): boolean => { let gotValue = false; forOwn(obj, (value, key) => { diff --git a/src/app/providers/test-result/__tests__/test-result.spec.ts b/src/app/providers/test-result/__tests__/test-result.spec.ts index f2f2a123fd..4d77c04f76 100644 --- a/src/app/providers/test-result/__tests__/test-result.spec.ts +++ b/src/app/providers/test-result/__tests__/test-result.spec.ts @@ -63,7 +63,10 @@ describe('TestResultCalculatorProvider', () => { [TestCategory.EUAM1, TestCategory.EUA1M1, TestCategory.EUA2M1, TestCategory.EUAMM1].forEach((cat) => { it(`should call calculateCatEUAM1AndSubCategoryTestResult if testCategory is ${cat}`, () => { - spyOn(testResultProvider, 'calculateCatEUAM1AndSubCategoryTestResult' as keyof TestResultProvider); + spyOn( + testResultProvider, + 'calculateCatEUAM1AndSubCategoryTestResult' as keyof TestResultProvider + ); testResultProvider.calculateTestResult(cat, null); expect(testResultProvider['calculateCatEUAM1AndSubCategoryTestResult']).toHaveBeenCalled(); }); @@ -71,7 +74,10 @@ describe('TestResultCalculatorProvider', () => { [TestCategory.EUAM2, TestCategory.EUA1M2, TestCategory.EUA2M2, TestCategory.EUAMM2].forEach((cat) => { it(`should call calculateCatEUAM2AndSubCategoryTestResult if testCategory is ${cat}`, () => { - spyOn(testResultProvider, 'calculateCatEUAM2AndSubCategoryTestResult' as keyof TestResultProvider); + spyOn( + testResultProvider, + 'calculateCatEUAM2AndSubCategoryTestResult' as keyof TestResultProvider + ); testResultProvider.calculateTestResult(cat, null); expect(testResultProvider['calculateCatEUAM2AndSubCategoryTestResult']).toHaveBeenCalled(); }); diff --git a/src/app/providers/test-submission/test-submission.ts b/src/app/providers/test-submission/test-submission.ts index b4835d50cb..16482ca475 100644 --- a/src/app/providers/test-submission/test-submission.ts +++ b/src/app/providers/test-submission/test-submission.ts @@ -32,8 +32,12 @@ export class TestSubmissionProvider { private appConfig: AppConfigProvider ) {} - submitTests = (testsToSubmit: TestToSubmit[]): Observable<(HttpResponse | HttpErrorResponse)[]> => { - const requests: Observable | HttpErrorResponse>[] = testsToSubmit.map((test) => this.submitTest(test)); + submitTests = ( + testsToSubmit: TestToSubmit[] + ): Observable<(HttpResponse | HttpErrorResponse)[]> => { + const requests: Observable | HttpErrorResponse>[] = testsToSubmit.map((test) => + this.submitTest(test) + ); return forkJoin(requests); }; @@ -48,7 +52,9 @@ export class TestSubmissionProvider { return ( this.httpClient - .post(this.buildUrl(testToSubmit), this.compressData(cleanData), { observe: 'response' }) + .post(this.buildUrl(testToSubmit), this.compressData(cleanData), { + observe: 'response', + }) // Note: Catching failures here (the inner observable) is what allows us to coordinate // subsequent success/fail actions in sendCompletedTestsEffect$ (the outer observable) .pipe( diff --git a/src/app/sentry-error-handler.ts b/src/app/sentry-error-handler.ts index 21d2bc0f82..d69729ddf2 100644 --- a/src/app/sentry-error-handler.ts +++ b/src/app/sentry-error-handler.ts @@ -24,6 +24,10 @@ const SENTRY_ERRORS_NODE_MODULES: SentryError[] = ['this._data[this._data.length export const SENTRY_ERRORS: SentryError[] = [...SENTRY_ERRORS_LIVERELOAD, ...SENTRY_ERRORS_NODE_MODULES]; +interface CustomError extends Error { + originalError?: Error; +} + @Injectable() export class SentryIonicErrorHandler extends ErrorHandler { // Cyclic DI dependency error if injecting services via the constructor @@ -31,7 +35,7 @@ export class SentryIonicErrorHandler extends ErrorHandler { super(); } - async handleError(error: unknown): Promise { + async handleError(error: CustomError): Promise { try { // call through to ionic error handler which is default behaviour super.handleError(error); diff --git a/src/app/shared/classes/__tests__/null.reducer.spec.ts b/src/app/shared/classes/__tests__/null.reducer.spec.ts index 456b7adb7e..45935ada03 100644 --- a/src/app/shared/classes/__tests__/null.reducer.spec.ts +++ b/src/app/shared/classes/__tests__/null.reducer.spec.ts @@ -2,6 +2,6 @@ import { nullReducer } from '../null.reducer'; describe('nullReducer', () => { it('should always return null', () => { - expect(nullReducer({}, {})).toEqual(null); + expect(nullReducer({}, { type: 'TEST_ACTION' })).toEqual(null); }); }); diff --git a/src/app/shared/classes/null.reducer.ts b/src/app/shared/classes/null.reducer.ts index 6f5541f412..f0ff1b49d0 100644 --- a/src/app/shared/classes/null.reducer.ts +++ b/src/app/shared/classes/null.reducer.ts @@ -1,8 +1,8 @@ -import {Action} from '@ngrx/store'; +import { Action } from '@ngrx/store'; export const initialState = null; -export function nullReducer(action: Action, state = initialState): {} { +export function nullReducer(action: {}, state = initialState): {} { return null; } diff --git a/src/app/shared/models/log.model.ts b/src/app/shared/models/log.model.ts index dd7b8d8924..16d711742e 100644 --- a/src/app/shared/models/log.model.ts +++ b/src/app/shared/models/log.model.ts @@ -10,5 +10,5 @@ export type Log = { message: string; timestamp: number; drivingExaminerId: string; - [propName: string]: string; + [propName: string]: string|number|{}; }; diff --git a/src/components/common/chart/chart.ts b/src/components/common/chart/chart.ts index 9a012a12dc..daa68b8358 100644 --- a/src/components/common/chart/chart.ts +++ b/src/components/common/chart/chart.ts @@ -25,7 +25,7 @@ export class ChartComponent implements OnInit, OnChanges { public chartType: ChartType = 'pie'; @Input() - public passedData: ExaminerRecordDataWithPercentage[] = null; + public passedData: ExaminerRecordDataWithPercentage[] = null; @Input() public showLegend = false; @@ -356,7 +356,7 @@ export class ChartComponent implements OnInit, OnChanges { * and sets the `dataValues` property based on the chart type. */ filterData() { - this.labels = this.passedData.map((val) => val.item.item); + this.labels = this.passedData.map((val) => val.item); const values: number[] = this.passedData.map((val) => val.count); this.average = values.reduce((a, b) => a + b, 0) / values.length || 0; this.tickCount = this.getTickCount(values); diff --git a/src/components/common/data-grid/data-grid.ts b/src/components/common/data-grid/data-grid.ts index 6256410791..0e50ee9b4f 100644 --- a/src/components/common/data-grid/data-grid.ts +++ b/src/components/common/data-grid/data-grid.ts @@ -11,7 +11,7 @@ export type PassedData = [string, number, string]; }) export class DataGridComponent implements OnInit { @Input() headers: string[] = null; - @Input() passedData: [][] = null; + @Input() passedData: number[][] = null; @Input() colourScheme: string[] = null; @Input() displayColour = false; @Input() showSeparator = true; diff --git a/src/components/common/end-test-link/__tests__/end-test-link.spec.ts b/src/components/common/end-test-link/__tests__/end-test-link.spec.ts index 40b830636d..44fad2525c 100644 --- a/src/components/common/end-test-link/__tests__/end-test-link.spec.ts +++ b/src/components/common/end-test-link/__tests__/end-test-link.spec.ts @@ -45,9 +45,11 @@ describe('EndTestLinkComponent', () => { it('should create an error modal', async () => { spyOn(modalController, 'create').and.returnValue( Promise.resolve({ - present: async () => {}, - onWillDismiss: async () => {}, - } as HTMLIonModalElement) + present: async () => { + }, + onWillDismiss: async () => { + }, + } as unknown as HTMLIonModalElement) ); await component.openEndTestModal(); expect(modalController.create).toHaveBeenCalled(); diff --git a/src/components/common/searchable-picklist-wrapper/__tests__/searchable-picklist-wrapper.spec.ts b/src/components/common/searchable-picklist-wrapper/__tests__/searchable-picklist-wrapper.spec.ts index d7b8d0f357..474256a831 100644 --- a/src/components/common/searchable-picklist-wrapper/__tests__/searchable-picklist-wrapper.spec.ts +++ b/src/components/common/searchable-picklist-wrapper/__tests__/searchable-picklist-wrapper.spec.ts @@ -5,8 +5,8 @@ import { ModalControllerMock } from '@mocks/ionic-mocks/modal-controller.mock'; import { PipesModule } from '@shared/pipes/pipes.module'; describe('SearchablePicklistComponentWrapper', () => { - let fixture: ComponentFixture; - let component: SearchablePicklistComponentWrapper; + let fixture: ComponentFixture>; + let component: SearchablePicklistComponentWrapper; let modalController: ModalController; beforeEach(waitForAsync(() => { diff --git a/src/components/common/signature-area/__tests__/signature-area.spec.ts b/src/components/common/signature-area/__tests__/signature-area.spec.ts index cb403e82b9..750813ba61 100644 --- a/src/components/common/signature-area/__tests__/signature-area.spec.ts +++ b/src/components/common/signature-area/__tests__/signature-area.spec.ts @@ -12,8 +12,8 @@ interface SignaturePad { width?: number; height?: number; xOffset?: number; - yOffset?: number -}; + yOffset?: number; +} describe('SignatureAreaComponent', () => { let fixture: ComponentFixture; diff --git a/src/components/common/signature-area/signature-area.ts b/src/components/common/signature-area/signature-area.ts index 98d1561287..de683d2914 100644 --- a/src/components/common/signature-area/signature-area.ts +++ b/src/components/common/signature-area/signature-area.ts @@ -158,7 +158,7 @@ export class SignatureAreaComponent implements ControlValueAccessor, AfterViewIn } } - registerOnChange(fn: string) { + registerOnChange(fn: (_: string) => void) { this.propagateChange = fn; } diff --git a/src/directives/__tests__/add-or-remove-lang-cy.directive.spec.ts b/src/directives/__tests__/add-or-remove-lang-cy.directive.spec.ts index 36fe27f387..5568363790 100644 --- a/src/directives/__tests__/add-or-remove-lang-cy.directive.spec.ts +++ b/src/directives/__tests__/add-or-remove-lang-cy.directive.spec.ts @@ -29,7 +29,7 @@ describe('AddOrRemoveLangCyDirective', () => { setAttribute: jasmine.createSpy(), } as SpyObj; translateMock = { - use(lang: string): Observable { + use(lang: string): Observable { translateMock.store.onLangChange.emit({ lang: lang, translations: null, diff --git a/src/store/app-info/__tests__/app-info.effects.spec.ts b/src/store/app-info/__tests__/app-info.effects.spec.ts index 2a88b9c011..15ce00bd91 100644 --- a/src/store/app-info/__tests__/app-info.effects.spec.ts +++ b/src/store/app-info/__tests__/app-info.effects.spec.ts @@ -3,7 +3,7 @@ import { Router } from '@angular/router'; import { Network } from '@awesome-cordova-plugins/network/ngx'; import { RouterMock } from '@mocks/angular-mocks/router-mock'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { DetectDeviceTheme } from '@pages/dashboard/dashboard.actions'; import { LOGIN_PAGE } from '@pages/page-names.constants'; import { AppInfoProviderMock } from '@providers/app-info/__mocks__/app-info.mock'; @@ -35,7 +35,7 @@ import { ReplaySubject, throwError } from 'rxjs'; describe('AppInfoEffects', () => { let effects: AppInfoEffects; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let appInfoProvider: AppInfoProvider; let dateTimeProvider: DateTimeProvider; let store$: Store; diff --git a/src/store/app-info/app-info.actions.ts b/src/store/app-info/app-info.actions.ts index f59c105a7d..b569a3e58e 100644 --- a/src/store/app-info/app-info.actions.ts +++ b/src/store/app-info/app-info.actions.ts @@ -7,7 +7,7 @@ export const LoadAppVersionSuccess = createAction( props<{ versionNumber: string }>() ); -export const LoadAppVersionFailure = createAction('[AppInfoEffects] Load App Version Failure', props<{error}>()); +export const LoadAppVersionFailure = createAction('[AppInfoEffects] Load App Version Failure', props<{ error }>()); export const LoadEmployeeId = createAction('[LoginComponent] Load Employee ID', props<{ employeeId: string }>()); diff --git a/src/store/examiner-records/__tests__/examiner-records.effects.spec.ts b/src/store/examiner-records/__tests__/examiner-records.effects.spec.ts index 046a3c8d45..d2bbf1d199 100644 --- a/src/store/examiner-records/__tests__/examiner-records.effects.spec.ts +++ b/src/store/examiner-records/__tests__/examiner-records.effects.spec.ts @@ -1,6 +1,6 @@ import { TestBed } from '@angular/core/testing'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { CacheExaminerRecords, ColourFilterChanged, @@ -18,7 +18,7 @@ import { ExaminerRecordsEffects } from '@store/examiner-records/examiner-records import { ReplaySubject, of } from 'rxjs'; describe('ExaminerRecordsStoreEffects', () => { - let actions$: ReplaySubject; + let actions$: ReplaySubject; let effects: ExaminerRecordsEffects; let store$: Store; let dataStore: DataStoreProvider; diff --git a/src/store/journal/__tests__/journal.effects.spec.ts b/src/store/journal/__tests__/journal.effects.spec.ts index ec76465181..7f50f919dc 100644 --- a/src/store/journal/__tests__/journal.effects.spec.ts +++ b/src/store/journal/__tests__/journal.effects.spec.ts @@ -43,7 +43,7 @@ import { journalReducer } from '../journal.reducer'; describe('JournalEffects', () => { let effects: JournalEffects; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let journalProvider: JournalProvider; let slotProvider: SlotProvider; let store$: Store; @@ -110,7 +110,7 @@ describe('JournalEffects', () => { // ARRANGE actions$ = new ReplaySubject(1); journalProvider = TestBed.inject(JournalProvider); - (journalProvider).resetErrors(); + (journalProvider as any).resetErrors(); effects = TestBed.inject(JournalEffects); slotProvider = TestBed.inject(SlotProvider); store$ = TestBed.inject(Store); @@ -150,7 +150,7 @@ describe('JournalEffects', () => { spyOn(slotProvider, 'detectSlotChanges').and.callThrough(); spyOn(slotProvider, 'extendWithEmptyDays').and.callThrough(); spyOn(slotProvider, 'getRelevantSlots').and.callThrough(); - (journalProvider).setupHttp304Error(); + (journalProvider).setupHttp304Error(); // ACT actions$.next(journalActions.LoadJournal()); // ASSERT @@ -173,7 +173,7 @@ describe('JournalEffects', () => { spyOn(slotProvider, 'extendWithEmptyDays').and.callThrough(); spyOn(slotProvider, 'getRelevantSlots').and.callThrough(); spyOn(store$, 'dispatch').and.callThrough(); - (journalProvider).setupTimeoutError(); + (journalProvider).setupTimeoutError(); // ACT actions$.next(journalActions.LoadJournal()); // ASSERT @@ -197,7 +197,7 @@ describe('JournalEffects', () => { spyOn(slotProvider, 'extendWithEmptyDays').and.callThrough(); spyOn(slotProvider, 'getRelevantSlots').and.callThrough(); spyOn(store$, 'dispatch').and.callThrough(); - (journalProvider).setupActualError(); + (journalProvider).setupActualError(); // ACT actions$.next(journalActions.LoadJournal()); // ASSERT @@ -219,7 +219,7 @@ describe('JournalEffects', () => { spyOn(slotProvider, 'detectSlotChanges').and.callThrough(); spyOn(slotProvider, 'extendWithEmptyDays').and.callThrough(); spyOn(slotProvider, 'getRelevantSlots').and.callThrough(); - (journalProvider).setupHttpError(); + (journalProvider).setupHttpError(); // ACT actions$.next(journalActions.LoadJournal()); // ASSERT @@ -233,7 +233,7 @@ describe('JournalEffects', () => { expect(result.type === '[JournalPage] Journal Refresh Error').toEqual(true); } else if (result.type === '[JournalEffects] Load Journal Failure') { expect(result.type === '[JournalEffects] Load Journal Failure').toEqual(true); - expect((result).error.message).toBe('Http failure response for (unknown url): 403 Forbidden'); + expect((result as any).error.message).toBe('Http failure response for (unknown url): 403 Forbidden'); } else { fail('Unknown Action Sent'); } diff --git a/src/store/logs/__tests__/logs.effects.spec.ts b/src/store/logs/__tests__/logs.effects.spec.ts index f47aa04fe1..259091cb5c 100644 --- a/src/store/logs/__tests__/logs.effects.spec.ts +++ b/src/store/logs/__tests__/logs.effects.spec.ts @@ -1,6 +1,6 @@ import { TestBed, fakeAsync, tick } from '@angular/core/testing'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import {Action, Store, StoreModule} from '@ngrx/store'; import { ReplaySubject } from 'rxjs'; import { AppConfigProviderMock } from '@providers/app-config/__mocks__/app-config.mock'; @@ -22,7 +22,7 @@ import { logsReducer } from '../logs.reducer'; describe('LogsEffects', () => { let effects: LogsEffects; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let cacheDays: number; let appConfigProviderMock: AppConfigProvider; let dataStoreMock: DataStoreProvider; diff --git a/src/store/reference-data/__tests__/reference-data.effects.spec.ts b/src/store/reference-data/__tests__/reference-data.effects.spec.ts index ac0cdf0170..19604ab0ab 100644 --- a/src/store/reference-data/__tests__/reference-data.effects.spec.ts +++ b/src/store/reference-data/__tests__/reference-data.effects.spec.ts @@ -21,7 +21,7 @@ import { RefDataStateModel, referenceDataReducer } from '@store/reference-data/r describe('ReferenceDataEffects', () => { let effects: ReferenceDataEffects; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let referenceDataProvider: ReferenceDataProvider; let dateTimeProvider: DateTimeProvider; let store$: Store; diff --git a/src/store/tests/__tests__/tests.analytics.effects.spec.ts b/src/store/tests/__tests__/tests.analytics.effects.spec.ts index ca0d416c3b..be47a6f3f0 100644 --- a/src/store/tests/__tests__/tests.analytics.effects.spec.ts +++ b/src/store/tests/__tests__/tests.analytics.effects.spec.ts @@ -4,7 +4,7 @@ import { Application } from '@dvsa/mes-journal-schema'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { RouterMock } from '@mocks/angular-mocks/router-mock'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; import { AnalyticsProvider } from '@providers/analytics/analytics'; import { AnalyticRecorded } from '@providers/analytics/analytics.actions'; @@ -42,7 +42,7 @@ describe('TestsAnalyticsEffects', () => { let effects: TestsAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; let navigationStateProviderMock: NavigationStateProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let store$: Store; const mockApplication: Application = { applicationId: 123456, diff --git a/src/store/tests/__tests__/tests.effects.spec.ts b/src/store/tests/__tests__/tests.effects.spec.ts index 3fb9a4d5d2..04c7410b3e 100644 --- a/src/store/tests/__tests__/tests.effects.spec.ts +++ b/src/store/tests/__tests__/tests.effects.spec.ts @@ -3,7 +3,7 @@ import { TestSlot } from '@dvsa/mes-journal-schema'; import { CategoryCode } from '@dvsa/mes-test-schema/categories/common'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import * as delegatedRekeySearchActions from '@pages/delegated-rekey-search/delegated-rekey-search.actions'; import { delegatedSearchReducer } from '@pages/delegated-rekey-search/delegated-rekey-search.reducer'; import * as rekeySearchActions from '@pages/rekey-search/rekey-search.actions'; @@ -50,7 +50,7 @@ import { initialState, testsReducer } from '../tests.reducer'; describe('TestsEffects', () => { let effects: TestsEffects; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let testPersistenceProviderMock; let store$: Store; let logHelper: LogHelper; diff --git a/src/store/tests/examiner-booked/__tests__/examiner-booked.effects.spec.ts b/src/store/tests/examiner-booked/__tests__/examiner-booked.effects.spec.ts index 15e06397c3..cad5d3101b 100644 --- a/src/store/tests/examiner-booked/__tests__/examiner-booked.effects.spec.ts +++ b/src/store/tests/examiner-booked/__tests__/examiner-booked.effects.spec.ts @@ -1,7 +1,7 @@ import { TestBed } from '@angular/core/testing'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { StoreModel } from '@shared/models/store.model'; import { ReplaySubject } from 'rxjs'; @@ -14,7 +14,7 @@ import { ExaminerBookedEffects } from '../examiner-booked.effects'; describe('ExaminerBookedEffects', () => { let effects: ExaminerBookedEffects; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let store$: Store; beforeEach(() => { diff --git a/src/store/tests/examiner-conducted/__tests__/examiner-conducted.effects.spec.ts b/src/store/tests/examiner-conducted/__tests__/examiner-conducted.effects.spec.ts index 36d0cb9436..b5979f9fb1 100644 --- a/src/store/tests/examiner-conducted/__tests__/examiner-conducted.effects.spec.ts +++ b/src/store/tests/examiner-conducted/__tests__/examiner-conducted.effects.spec.ts @@ -1,7 +1,7 @@ import { TestBed } from '@angular/core/testing'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { StoreModel } from '@shared/models/store.model'; import { journalReducer } from '@store/journal/journal.reducer'; import { ReplaySubject } from 'rxjs'; @@ -14,7 +14,7 @@ import { ExaminerConductedEffects } from '../examiner-conducted.effects'; describe('ExaminerConductedEffects', () => { let effects: ExaminerConductedEffects; - let actions$: ReplaySubject; + let actions$: ReplaySubject; let store$: Store; beforeEach(() => { diff --git a/src/store/tests/test-data/__tests__/test-data.effects.spec.ts b/src/store/tests/test-data/__tests__/test-data.effects.spec.ts index 65870504d6..b4b078ed67 100644 --- a/src/store/tests/test-data/__tests__/test-data.effects.spec.ts +++ b/src/store/tests/test-data/__tests__/test-data.effects.spec.ts @@ -1,7 +1,7 @@ import { TestBed } from '@angular/core/testing'; import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule, Action } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { StoreModel } from '@shared/models/store.model'; import { ReplaySubject } from 'rxjs'; diff --git a/src/store/tests/test-status/__tests__/test-status.analytics.effects.spec.ts b/src/store/tests/test-status/__tests__/test-status.analytics.effects.spec.ts index 300e81d36d..bb686ff1e9 100644 --- a/src/store/tests/test-status/__tests__/test-status.analytics.effects.spec.ts +++ b/src/store/tests/test-status/__tests__/test-status.analytics.effects.spec.ts @@ -1,6 +1,6 @@ import { TestBed } from '@angular/core/testing'; import { provideMockActions } from '@ngrx/effects/testing'; -import { Store, StoreModule } from '@ngrx/store'; +import { Action, Store, StoreModule } from '@ngrx/store'; import { ReplaySubject } from 'rxjs'; import { AnalyticsProviderMock } from '@providers/analytics/__mocks__/analytics.mock'; @@ -16,7 +16,7 @@ import { TestStatusAnalyticsEffects } from '../test-status.analytics.effects'; describe('TestStatusAnalyticsEffects', () => { let effects: TestStatusAnalyticsEffects; let analyticsProviderMock: AnalyticsProvider; - let actions$: ReplaySubject; + let actions$: ReplaySubject; beforeEach(() => { TestBed.configureTestingModule({ diff --git a/src/store/tests/tests.cat-adi-part2.reducer.ts b/src/store/tests/tests.cat-adi-part2.reducer.ts index 19a71e2148..5624327701 100644 --- a/src/store/tests/tests.cat-adi-part2.reducer.ts +++ b/src/store/tests/tests.cat-adi-part2.reducer.ts @@ -22,6 +22,7 @@ import { testDataCatADI2Reducer } from './test-data/cat-adi-part2/test-data.cat- import { testSummaryReducer } from './test-summary/test-summary.reducer'; import { trainerDetailsCatADIPart2Reducer } from './trainer-details/cat-adi-part2/trainer-details.cat-adi-part2.reducer'; import { vehicleDetailsCatADIPart2Reducer } from './vehicle-details/cat-adi-part2/vehicle-details.cat-adi-part2.reducer'; +import {passCompletionReducer} from '@store/tests/pass-completion/pass-completion.reducer'; export function testsCatADIPart2Reducer( action: Action, @@ -39,7 +40,7 @@ export function testsCatADIPart2Reducer( examinerConducted: examinerConductedReducer, examinerKeyed: examinerKeyedReducer, journalData: journalDataCatADIPart2Reducer, - passCompletion: nullReducer, + passCompletion: passCompletionReducer, postTestDeclarations: postTestDeclarationsReducer, preTestDeclarations: preTestDeclarationsReducer, rekey: rekeyReducer, diff --git a/src/store/tests/tests.effects.ts b/src/store/tests/tests.effects.ts index 09e60f2ee8..643d299d6d 100644 --- a/src/store/tests/tests.effects.ts +++ b/src/store/tests/tests.effects.ts @@ -387,7 +387,7 @@ export class TestsEffects { } return this.testSubmissionProvider.submitTests(completedTests).pipe( - switchMap((responses: HttpResponse[]) => { + switchMap((responses: HttpResponse[]) => { return responses.map((response, index) => { const matchedTests = find(completedTests, ['index', index]); if (response.status === HttpStatusCode.Created) { @@ -450,7 +450,7 @@ export class TestsEffects { }; return this.testSubmissionProvider.submitTest(testToSubmit).pipe( - map((response: HttpResponse | HttpErrorResponse) => { + map((response: HttpResponse | HttpErrorResponse) => { if (response.status === HttpStatusCode.Created) { return testActions.SendCurrentTestSuccess(); }