Skip to content

Commit

Permalink
biome implementation of no implicit any
Browse files Browse the repository at this point in the history
  • Loading branch information
gittins7 committed Nov 5, 2024
1 parent 0b87a5c commit d078d9b
Show file tree
Hide file tree
Showing 120 changed files with 376 additions and 397 deletions.
13 changes: 13 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@
}
}
}
},
{
"include": [
"**/*.spec.ts"
],
"linter": {
"enabled": true,
"rules": {
"suspicious": {
"noExplicitAny": "off"
}
}
}
}
]
}
2 changes: 1 addition & 1 deletion src/app/__tests__/sentry-error-handler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
14 changes: 2 additions & 12 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,7 @@ export function localStorageSyncReducer(reducer: ActionReducer<StoreModel>): Act
})(reducer);
}

export interface AppState {
journal: JournalState;
appInfo: AppInfoState;
appConfig: AppConfigState;
tests: TestsState;
rekeySearch: RekeySearchState;
delegatedRekeySearch: DelegatedSearchState;
examinerRecords: ExaminerRecordsState;
}

const reducers: ActionReducerMap<AppState> = {
const reducers: ActionReducerMap<unknown> = {
journal: journalReducer,
appInfo: appInfoReducer,
appConfig: appConfigReducer,
Expand All @@ -107,7 +97,7 @@ const reducers: ActionReducerMap<AppState> = {
examinerRecords: examinerRecordsReducer,
};

const metaReducers: MetaReducer<AppState>[] = [];
const metaReducers: MetaReducer<unknown>[] = [];
const enableDevTools = environment && (environment as EnvironmentFile).enableDevTools;
const enableRehydrationPlugin = environment && (environment as EnvironmentFile).enableRehydrationPlugin;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -33,7 +33,7 @@ import { BackToOfficeAnalyticsEffects } from '../back-to-office.analytics.effect
describe('BackToOfficeAnalyticsEffects', () => {
let effects: BackToOfficeAnalyticsEffects;
let analyticsProviderMock: AnalyticsProvider;
let actions$: ReplaySubject<any>;
let actions$: ReplaySubject<Action>;
let store$: Store<StoreModel>;
const screenName = AnalyticsScreenNames.BACK_TO_OFFICE;
const mockApplication: Application = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -30,7 +30,7 @@ import { ReplaySubject } from 'rxjs';
describe('CandidateDetailsAnalyticsEffects', () => {
let effects: CandidateDetailsAnalyticsEffects;
let analyticsProviderMock: AnalyticsProvider;
let actions$: ReplaySubject<any>;
let actions$: ReplaySubject<Action>;
let store$: Store<StoreModel>;
const screenName = AnalyticsScreenNames.CANDIDATE_DETAILS;
const mockTestSlot = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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<Action>;
let store$: Store<StoreModel>;
const screenName = AnalyticsScreenNames.CANDIDATE_LICENCE_INFO;
const mockApplication: Application = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -39,7 +39,7 @@ import { CommunicationAnalyticsEffects } from '../communication.analytics.effect
describe('CommunicationAnalyticsEffects', () => {
let effects: CommunicationAnalyticsEffects;
let analyticsProviderMock: AnalyticsProvider;
let actions$: ReplaySubject<any>;
let actions$: ReplaySubject<Action>;
let store$: Store<StoreModel>;
const screenName = AnalyticsScreenNames.COMMUNICATION;
const screenNamePM = `${GoogleAnalyticsEventPrefix.PRACTICE_MODE}_${AnalyticsScreenNames.COMMUNICATION}`;
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -9,7 +9,7 @@ import { CommunicationEffects } from '../communication.effects';

describe('CommunicationEffects', () => {
let effects: CommunicationEffects;
let actions$: ReplaySubject<any>;
let actions$: ReplaySubject<Action>;
const currentSlotId = '1234';

beforeEach(waitForAsync(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -25,7 +25,7 @@ import * as confirmTestDetailsActions from '../confirm-test-details.actions';
describe('ConfirmTestDetailsAnalyticsEffects', () => {
let effects: ConfirmTestDetailsAnalyticsEffects;
let analyticsProviderMock: AnalyticsProvider;
let actions$: ReplaySubject<any>;
let actions$: ReplaySubject<Action>;
let store$: Store<StoreModel>;
const screenName = AnalyticsScreenNames.CONFIRM_TEST_DETAILS;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -31,7 +31,7 @@ import { DashboardAnalyticsEffects } from '../dashboard.analytics.effects';
describe('DashboardAnalyticsEffects', () => {
let effects: DashboardAnalyticsEffects;
let analyticsProviderMock: AnalyticsProvider;
let actions$: ReplaySubject<any>;
let actions$: ReplaySubject<Action>;
const screenName = AnalyticsScreenNames.DASHBOARD;

beforeEach(waitForAsync(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/debrief/__tests__/debrief.effects.spec.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
(<any>welshTranslations).debrief.competencies.useOfSpeed
welshTranslations.debrief.competencies.useOfSpeed
);
expect(drivingFaultsLabels[1].nativeElement.innerHTML.trim()).toBe(
(<any>welshTranslations).debrief.competencies.signalsTimed
welshTranslations.debrief.competencies.signalsTimed
);
expect(drivingFaultCount.innerHTML).toBe(drivingFaults.length.toString());
done();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
});

Expand All @@ -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();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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<any>;
let actions$: ReplaySubject<Action>;
let delegatedRekeySearchProvider: DelegatedRekeySearchProvider;
let searchProvider: SearchProvider;

Expand Down
Loading

0 comments on commit d078d9b

Please sign in to comment.