Skip to content

Commit

Permalink
update unit tests to remove deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsetterfield committed Apr 29, 2024
1 parent 5e0db88 commit a5d02fe
Show file tree
Hide file tree
Showing 21 changed files with 42 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ import { EndTestLinkComponent } from '@components/common/end-test-link/end-test-
import { LockScreenIndicator } from '@components/common/screen-lock-indicator/lock-screen-indicator';
import { CandidateSectionComponent } from '@components/common/candidate-section/candidate-section';
import { candidateMock } from '@store/tests/__mocks__/tests.mock';
import { Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { Router, RouterModule } from '@angular/router';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { CommunicationPage } from '@pages/communication/communication.page';
import { CommunicationSubmitInfo, CommunicationViewDidEnter } from '@pages/communication/communication.actions';
Expand Down Expand Up @@ -53,7 +52,7 @@ describe('CommunicationPage', () => {
MockComponent(CandidateSectionComponent),
],
imports: [
RouterTestingModule.withRoutes([]),
RouterModule.forRoot([]),
AppModule,
TranslateModule,
ReactiveFormsModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { By } from '@angular/platform-browser';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { provideMockStore } from '@ngrx/store/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { ModalControllerMock } from '@mocks/ionic-mocks/modal-controller.mock';
import { ComponentsModule } from '@components/common/common-components.module';
import { IonicModule, ModalController, NavParams } from '@ionic/angular';
Expand All @@ -12,6 +11,7 @@ import {
} from '@pages/journal/components/journal-early-start-modal/__mocks__/journal-early-start-modal.mock';
import { NavParamsMock } from '@pages/journal/components/journal-early-start-modal/__mocks__/nav-params.mock';
import { ConfirmSubmitModal } from '../confirm-submit-modal';
import { RouterModule } from '@angular/router';

describe('ConfirmSubmitModal', () => {
let modalFixture: ComponentFixture<ConfirmSubmitModal>;
Expand All @@ -25,7 +25,7 @@ describe('ConfirmSubmitModal', () => {
ConfirmSubmitModal,
],
imports: [
RouterTestingModule,
RouterModule,
CommonModule,
FormsModule,
IonicModule,
Expand Down
5 changes: 2 additions & 3 deletions src/app/pages/dashboard/__tests__/dashboard.page.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { AlertController, IonicModule, ModalController, Platform } from '@ionic/angular';
import { AlertControllerMock, ModalControllerMock, PlatformMock, RouterMock } from '@mocks/index.mock';
import { RouterTestingModule } from '@angular/router/testing';
import { Router } from '@angular/router';
import { Router, RouterModule } from '@angular/router';
import { StoreModule } from '@ngrx/store';
import { MockStore, provideMockStore } from '@ngrx/store/testing';
import { of, Subscription } from 'rxjs';
Expand Down Expand Up @@ -78,7 +77,7 @@ describe('DashboardPage', () => {
TestBed.configureTestingModule({
declarations: [DashboardPage],
imports: [
RouterTestingModule.withRoutes(
RouterModule.forRoot(
[
{
path: '',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { Router, RouterModule } from '@angular/router';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { JOURNAL_PAGE } from '@pages/page-names.constants';
import { JournalPage } from '@pages/journal/journal.page';
Expand All @@ -17,7 +16,7 @@ describe('GoToJournalCard', () => {
declarations: [GoToJournalCardComponent],
imports: [
IonicModule,
RouterTestingModule.withRoutes(
RouterModule.forRoot(
[
{
path: 'journal',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { By } from '@angular/platform-browser';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { provideMockStore } from '@ngrx/store/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { ModalControllerMock } from '@mocks/ionic-mocks/modal-controller.mock';
import { ComponentsModule } from '@components/common/common-components.module';
import { IonicModule, ModalController, NavParams } from '@ionic/angular';
Expand All @@ -12,6 +11,7 @@ import {
} from '@pages/journal/components/journal-early-start-modal/__mocks__/journal-early-start-modal.mock';
import { NavParamsMock } from '@pages/journal/components/journal-early-start-modal/__mocks__/nav-params.mock';
import { HealthDeclarationModal } from '../health-declaration-modal';
import { RouterModule } from '@angular/router';

describe('healthDeclarationModal', () => {
let modalFixture: ComponentFixture<HealthDeclarationModal>;
Expand All @@ -25,7 +25,7 @@ describe('healthDeclarationModal', () => {
HealthDeclarationModal,
],
imports: [
RouterTestingModule,
RouterModule,
CommonModule,
FormsModule,
IonicModule,
Expand Down
5 changes: 2 additions & 3 deletions src/app/pages/journal/__tests__/journal.page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { StoreModel } from '@shared/models/store.model';
import { Subscription } from 'rxjs';
import { DateTimeProvider } from '@providers/date-time/date-time';
import { DateTimeProviderMock } from '@providers/date-time/__mocks__/date-time.mock';
import { RouterTestingModule } from '@angular/router/testing';
import { CUSTOM_ELEMENTS_SCHEMA, DebugElement } from '@angular/core';
import { JournalPage } from '@pages/journal/journal.page';
import { JournalComponentsModule } from '@pages/journal/components/journal-components.module';
Expand Down Expand Up @@ -46,7 +45,7 @@ import { AccessibilityService } from '@providers/accessibility/accessibility.ser
import { AccessibilityServiceMock } from '@providers/accessibility/__mocks__/accessibility-service.mock';
import { LogHelper } from '@providers/logs/logs-helper';
import { LogHelperMock } from '@providers/logs/__mocks__/logs-helper.mock';
import { ActivatedRoute } from '@angular/router';
import { ActivatedRoute, RouterModule } from '@angular/router';
import { HttpStatusCode } from '@angular/common/http';

describe('JournalPage', () => {
Expand All @@ -69,7 +68,7 @@ describe('JournalPage', () => {
JournalPage,
],
imports: [
RouterTestingModule.withRoutes([]),
RouterModule.forRoot([]),
JournalComponentsModule,
TestSlotComponentsModule,
StoreModule.forRoot({
Expand Down
5 changes: 2 additions & 3 deletions src/app/pages/login/__tests__/login.page.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { ComponentFixture, fakeAsync, flushMicrotasks, TestBed, waitForAsync } from '@angular/core/testing';
import { AlertController, IonicModule, LoadingController, MenuController, Platform } from '@ionic/angular';
import { Navigation, NavigationExtras, Router } from '@angular/router';
import { Navigation, NavigationExtras, Router, RouterModule } from '@angular/router';
import { StoreModule } from '@ngrx/store';
import { SplashScreen } from '@capacitor/splash-screen';
import { Capacitor } from '@capacitor/core';
import { RouterTestingModule } from '@angular/router/testing';
import { MockStore, provideMockStore } from '@ngrx/store/testing';
import { AppConfigProvider } from '@providers/app-config/app-config';
import { AppConfigProviderMock } from '@providers/app-config/__mocks__/app-config.mock';
Expand Down Expand Up @@ -52,7 +51,7 @@ describe('LoginPage', () => {
TestBed.configureTestingModule({
declarations: [LoginPage],
imports: [
RouterTestingModule.withRoutes(
RouterModule.forRoot(
[
{
path: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ import { NavController, Platform } from '@ionic/angular';
import { AppModule } from '@app/app.module';
import { D255Component } from '@components/test-finalisation/d255/d255';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { Router, RouterModule } from '@angular/router';
import { OutcomeBehaviourMapProvider } from '@providers/outcome-behaviour-map/outcome-behaviour-map';
import { PersistTests } from '@store/tests/tests.actions';
import { UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
Expand Down Expand Up @@ -61,7 +60,7 @@ describe('PassFinalisationCatAMod1Page', () => {
MockComponent(LicenceProvidedWarningBannerComponent),
],
imports: [
RouterTestingModule.withRoutes([]),
RouterModule.forRoot([]),
AppModule,
],
providers: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ import { WarningBannerComponent } from '@components/common/warning-banner/warnin
import {
LicenceProvidedWarningBannerComponent,
} from '@pages/pass-finalisation/components/licence-provided-warning-banner/licence-provided-warning-banner';
import { RouterTestingModule } from '@angular/router/testing';
import { AppModule } from '@app/app.module';
import { NavControllerMock, PlatformMock, RouterMock } from '@mocks/index.mock';
import { Router } from '@angular/router';
import { Router, RouterModule } from '@angular/router';
import { AuthenticationProvider } from '@providers/authentication/authentication';
import { AuthenticationProviderMock } from '@providers/authentication/__mocks__/authentication.mock';
import { OutcomeBehaviourMapProvider } from '@providers/outcome-behaviour-map/outcome-behaviour-map';
Expand Down Expand Up @@ -66,7 +65,7 @@ describe('PassFinalisationCatAMod2Page', () => {
MockComponent(LicenceProvidedWarningBannerComponent),
],
imports: [
RouterTestingModule.withRoutes([]),
RouterModule.forRoot([]),
AppModule,
],
providers: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ import { NavController, Platform } from '@ionic/angular';
import { AppModule } from '@app/app.module';
import { D255Component } from '@components/test-finalisation/d255/d255';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { Router, RouterModule } from '@angular/router';
import { OutcomeBehaviourMapProvider } from '@providers/outcome-behaviour-map/outcome-behaviour-map';
import { PersistTests } from '@store/tests/tests.actions';
import { UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
Expand Down Expand Up @@ -55,7 +54,7 @@ describe('PassFinalisationCatADI2Page', () => {
MockComponent(LicenceProvidedWarningBannerComponent),
],
imports: [
RouterTestingModule.withRoutes([]),
RouterModule.forRoot([]),
AppModule,
],
providers: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { NavController, Platform } from '@ionic/angular';
import { NavControllerMock, PlatformMock, RouterMock } from '@mocks/index.mock';
import { Router } from '@angular/router';
import { Router, RouterModule } from '@angular/router';
import { AuthenticationProvider } from '@providers/authentication/authentication';
import { AuthenticationProviderMock } from '@providers/authentication/__mocks__/authentication.mock';
import { OutcomeBehaviourMapProvider } from '@providers/outcome-behaviour-map/outcome-behaviour-map';
Expand All @@ -11,7 +11,6 @@ import { MockComponent } from 'ng-mocks';
import { PracticeModeBanner } from '@components/common/practice-mode-banner/practice-mode-banner';
import { DebriefWitnessedComponent } from '@components/test-finalisation/debrief-witnessed/debrief-witnessed';
import { FinalisationHeaderComponent } from '@components/test-finalisation/finalisation-header/finalisation-header';
import { RouterTestingModule } from '@angular/router/testing';
import { AppModule } from '@app/app.module';
import {
FurtherDevelopmentComponent,
Expand Down Expand Up @@ -118,7 +117,7 @@ describe('PassFinalisationCatADIPart3Page', () => {
MockComponent(FurtherDevelopmentComponent),
],
imports: [
RouterTestingModule.withRoutes([]),
RouterModule.forRoot([]),
AppModule,
],
providers: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ import {
} from '@pages/pass-finalisation/components/pass-certificate-number/pass-certificate-number.constants';
import { D255Component } from '@components/test-finalisation/d255/d255';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { Router, RouterModule } from '@angular/router';
import { OutcomeBehaviourMapProvider } from '@providers/outcome-behaviour-map/outcome-behaviour-map';
import { ProvisionalLicenseNotReceived } from '@store/tests/pass-completion/pass-completion.actions';
import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category';
Expand Down Expand Up @@ -136,7 +135,7 @@ describe('PassFinalisationCatBPage', () => {
MockComponent(LicenceProvidedWarningBannerComponent),
],
imports: [
RouterTestingModule.withRoutes([]),
RouterModule.forRoot([]),
AppModule,
],
providers: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ import { NavController, Platform } from '@ionic/angular';
import { AppModule } from '@app/app.module';
import { D255Component } from '@components/test-finalisation/d255/d255';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { Router, RouterModule } from '@angular/router';
import { OutcomeBehaviourMapProvider } from '@providers/outcome-behaviour-map/outcome-behaviour-map';
import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category';
import { TransmissionType } from '@shared/models/transmission-type';
Expand Down Expand Up @@ -270,7 +269,7 @@ describe('PassFinalisationCatCPage', () => {
MockComponent(LicenceProvidedWarningBannerComponent),
],
imports: [
RouterTestingModule.withRoutes([]),
RouterModule.forRoot([]),
AppModule,
],
providers: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ import {
import { NavController, Platform } from '@ionic/angular';
import { AppModule } from '@app/app.module';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { Router, RouterModule } from '@angular/router';
import { OutcomeBehaviourMapProvider } from '@providers/outcome-behaviour-map/outcome-behaviour-map';
import { PersistTests } from '@store/tests/tests.actions';
import { UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
Expand Down Expand Up @@ -46,7 +45,7 @@ describe('PassFinalisationCatCPCPage', () => {
MockComponent(WarningBannerComponent),
],
imports: [
RouterTestingModule.withRoutes([]),
RouterModule.forRoot([]),
AppModule,
],
providers: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ import {
import { AppModule } from '@app/app.module';
import { D255Component } from '@components/test-finalisation/d255/d255';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { Router, RouterModule } from '@angular/router';
import { OutcomeBehaviourMapProvider } from '@providers/outcome-behaviour-map/outcome-behaviour-map';
import { TestCategory } from '@dvsa/mes-test-schema/category-definitions/common/test-category';
import { TransmissionType } from '@shared/models/transmission-type';
Expand Down Expand Up @@ -267,7 +266,7 @@ describe('PassFinalisationCatDPage', () => {
MockComponent(LicenceProvidedWarningBannerComponent),
],
imports: [
RouterTestingModule.withRoutes([]),
RouterModule.forRoot([]),
AppModule,
],
providers: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ import { NavController, Platform } from '@ionic/angular';
import { AppModule } from '@app/app.module';
import { D255Component } from '@components/test-finalisation/d255/d255';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { Router, RouterModule } from '@angular/router';
import { OutcomeBehaviourMapProvider } from '@providers/outcome-behaviour-map/outcome-behaviour-map';
import { PersistTests } from '@store/tests/tests.actions';
import { UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
Expand Down Expand Up @@ -57,7 +56,7 @@ describe('PassFinalisationCatHomeTestPage', () => {
MockComponent(LicenceProvidedWarningBannerComponent),
],
imports: [
RouterTestingModule.withRoutes([]),
RouterModule.forRoot([]),
AppModule,
],
providers: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import { NavController, Platform } from '@ionic/angular';
import { AppModule } from '@app/app.module';
import { D255Component } from '@components/test-finalisation/d255/d255';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { Router, RouterModule } from '@angular/router';
import { OutcomeBehaviourMapProvider } from '@providers/outcome-behaviour-map/outcome-behaviour-map';
import { PersistTests } from '@store/tests/tests.actions';
import { UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
Expand Down Expand Up @@ -55,7 +54,7 @@ describe('PassFinalisationCatManoeuvrePage', () => {
MockComponent(LicenceProvidedWarningBannerComponent),
],
imports: [
RouterTestingModule.withRoutes([]),
RouterModule.forRoot([]),
AppModule,
],
providers: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing';

import { Router } from '@angular/router';
import { Router, RouterModule } from '@angular/router';
import { StoreModule } from '@ngrx/store';
import { RouterTestingModule } from '@angular/router/testing';
import { AppModule } from '@app/app.module';
import { MockComponent } from 'ng-mocks';
import { PracticeModeBanner } from '@components/common/practice-mode-banner/practice-mode-banner';
Expand All @@ -24,7 +23,7 @@ describe('PostDebriefHoldingPage', () => {
MockComponent(PracticeModeBanner),
],
imports: [
RouterTestingModule.withRoutes([]),
RouterModule.forRoot([]),
AppModule,
StoreModule.forFeature('tests', () => ({})),
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule, LoadingController } from '@ionic/angular';
import { CommonModule } from '@angular/common';
import { RouterTestingModule } from '@angular/router/testing';
import { MockStore, provideMockStore } from '@ngrx/store/testing';
import { StoreModule } from '@ngrx/store';
import { of, throwError } from 'rxjs';
Expand Down Expand Up @@ -33,7 +32,7 @@ import { TestCentreJournalPage } from '../test-centre-journal.page';
import { TestCentreJournalComponentsModule } from '../components/test-centre-journal-components.module';
import { DeviceProvider } from '@providers/device/device';
import { DeviceProviderMock } from '@providers/device/__mocks__/device.mock';
import { ActivatedRoute } from '@angular/router';
import { ActivatedRoute, RouterModule } from '@angular/router';
import { ActivatedRouteMock } from '@mocks/angular-mocks/activated-route.mock';
import { HttpStatusCode } from '@angular/common/http';

Expand All @@ -57,7 +56,7 @@ describe('TestCenterJournalPage', () => {
CommonModule,
ComponentsModule,
TestCentreJournalComponentsModule,
RouterTestingModule.withRoutes(
RouterModule.forRoot(
[
{
path: '',
Expand Down
Loading

0 comments on commit a5d02fe

Please sign in to comment.