Skip to content

Commit 809515b

Browse files
committed
fix(mondomifa): upgrading testing modules
1 parent 87f0574 commit 809515b

24 files changed

+92
-102
lines changed

packages/portail-usagers/angular.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"outputPath": "dist/domifa-portail-usagers",
2222
"index": "src/index.html",
2323
"main": "src/main.ts",
24-
"polyfills": "src/polyfills.ts",
24+
"polyfills": ["@angular/localize/init", "zone.js"],
2525
"tsConfig": "./tsconfig.app.json",
2626
"assets": ["src/assets", "src/robots.txt"],
2727
"styles": [

packages/portail-usagers/jest.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module.exports = {
22
preset: "jest-preset-angular",
3-
globalSetup: "jest-preset-angular/global-setup",
43
moduleNameMapper: {
54
"^src/(.*)$": "<rootDir>/src/$1",
65
"^app/(.*)$": "<rootDir>/src/app/$1",

packages/portail-usagers/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@
4545
},
4646
"devDependencies": {
4747
"@angular-devkit/architect": "^0.2001.5",
48-
"@angular-devkit/build-angular": "^18.2.13",
49-
"@angular-devkit/core": "^18.2.13",
50-
"@angular-devkit/schematics": "^18.1.1",
48+
"@angular-devkit/build-angular": "^18.2.20",
49+
"@angular-devkit/core": "^18.2.20",
50+
"@angular-devkit/schematics": "^18.2.20",
5151
"@angular-eslint/builder": "^17.5.3",
5252
"@angular-eslint/eslint-plugin": "^17.5.3",
5353
"@angular-eslint/eslint-plugin-template": "^17.5.3",
5454
"@angular-eslint/schematics": "^17.5.3",
5555
"@angular-eslint/template-parser": "^17.5.3",
56-
"@angular/cli": "^18.2.13",
56+
"@angular/cli": "^18.2.20",
5757
"@angular/compiler-cli": "^18.2.13",
5858
"@angular/language-service": "^18.2.13",
5959
"@types/file-saver": "^2.0.7",

packages/portail-usagers/src/app/app.component.spec.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1-
import { HttpClientTestingModule } from "@angular/common/http/testing";
1+
import { provideHttpClient } from "@angular/common/http";
2+
import { provideHttpClientTesting } from "@angular/common/http/testing";
23
import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from "@angular/core";
3-
import { TestBed, waitForAsync } from "@angular/core/testing";
4-
5-
import { RouterTestingModule } from "@angular/router/testing";
4+
import { TestBed } from "@angular/core/testing";
65

76
import { AppComponent } from "./app.component";
87
import { MATOMO_INJECTORS } from "./shared";
8+
import { RouterModule } from "@angular/router";
9+
import { UsagerAuthService } from "./modules/usager-auth/services/usager-auth.service";
910

1011
describe("AppComponent", () => {
11-
beforeEach(waitForAsync(() => {
12+
beforeEach(() => {
1213
TestBed.configureTestingModule({
1314
declarations: [AppComponent],
14-
imports: [
15-
HttpClientTestingModule,
16-
...MATOMO_INJECTORS,
17-
RouterTestingModule,
15+
imports: [...MATOMO_INJECTORS, RouterModule.forRoot([])],
16+
providers: [
17+
UsagerAuthService,
18+
provideHttpClient(),
19+
provideHttpClientTesting(),
1820
],
1921
schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA],
2022
}).compileComponents();
21-
}));
23+
});
2224

2325
it("should create the app", () => {
2426
const fixture = TestBed.createComponent(AppComponent);

packages/portail-usagers/src/app/app.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ registerLocaleData(localeFr, "fr");
5050
MATOMO_INJECTORS,
5151
],
5252
providers: [
53+
provideHttpClient(withInterceptorsFromDi()),
5354
UsagerAuthService,
5455
CustomToastService,
5556
{ provide: LOCALE_ID, useValue: "fr" },
5657
{ provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true },
5758
provideUserIdleConfig({ idle: 3600, timeout: 60, ping: 20 }),
58-
provideHttpClient(withInterceptorsFromDi()),
5959
],
6060
})
6161
export class AppModule {}

packages/portail-usagers/src/app/guards/auth-guard.spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import { RouterTestingModule } from "@angular/router/testing";
21
import { APP_BASE_HREF } from "@angular/common";
3-
import { HttpClientTestingModule } from "@angular/common/http/testing";
42
import { inject, TestBed } from "@angular/core/testing";
53
import {
64
ActivatedRouteSnapshot,
75
Router,
6+
RouterModule,
87
RouterStateSnapshot,
98
} from "@angular/router";
109

1110
import { UsagerAuthService } from "../modules/usager-auth/services/usager-auth.service";
1211

1312
import { AuthGuard } from "./auth-guard";
13+
import { provideHttpClient } from "@angular/common/http";
1414

1515
describe("AuthGuard", () => {
1616
let authGuard: AuthGuard;
@@ -19,9 +19,10 @@ describe("AuthGuard", () => {
1919

2020
beforeEach(() => {
2121
TestBed.configureTestingModule({
22-
imports: [HttpClientTestingModule, RouterTestingModule],
22+
imports: [RouterModule.forRoot([])],
2323
providers: [
2424
AuthGuard,
25+
provideHttpClient(),
2526
{
2627
provide: ActivatedRouteSnapshot,
2728
useValue: {

packages/portail-usagers/src/app/modules/general/components/_static/news/news.component.spec.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
22
import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing";
3-
import { HttpClientTestingModule } from "@angular/common/http/testing";
4-
import { RouterTestingModule } from "@angular/router/testing";
5-
63
import { NewsComponent } from "./news.component";
74
import { SharedModule } from "../../../../shared/shared.module";
5+
import { RouterModule } from "@angular/router";
6+
import { provideHttpClient } from "@angular/common/http";
87

98
describe("NewsComponent", () => {
109
let component: NewsComponent;
@@ -13,12 +12,8 @@ describe("NewsComponent", () => {
1312
beforeEach(waitForAsync(() => {
1413
TestBed.configureTestingModule({
1514
declarations: [NewsComponent],
16-
imports: [
17-
HttpClientTestingModule,
18-
RouterTestingModule,
19-
NgbModule,
20-
SharedModule,
21-
],
15+
imports: [RouterModule.forRoot([]), NgbModule, SharedModule],
16+
providers: [provideHttpClient()],
2217
}).compileComponents();
2318
}));
2419

packages/portail-usagers/src/app/modules/general/components/_static/plan-site/plan-site.component.spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing";
22
import { PlanSiteComponent } from "./plan-site.component";
3-
import { RouterTestingModule } from "@angular/router/testing";
4-
import { HttpClientTestingModule } from "@angular/common/http/testing";
53
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
64
import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
5+
import { RouterModule } from "@angular/router";
6+
import { provideHttpClient } from "@angular/common/http";
77

88
describe("PlanSiteComponent", () => {
99
let component: PlanSiteComponent;
@@ -12,7 +12,8 @@ describe("PlanSiteComponent", () => {
1212
beforeEach(waitForAsync(() => {
1313
TestBed.configureTestingModule({
1414
declarations: [PlanSiteComponent],
15-
imports: [NgbModule, RouterTestingModule, HttpClientTestingModule],
15+
imports: [NgbModule, RouterModule.forRoot([])],
16+
providers: [provideHttpClient()],
1617
schemas: [CUSTOM_ELEMENTS_SCHEMA],
1718
}).compileComponents();
1819
}));

packages/portail-usagers/src/app/modules/general/components/idle-manager/idle-manager.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { HttpClientTestingModule } from "@angular/common/http/testing";
21
import { ComponentFixture, TestBed } from "@angular/core/testing";
32
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
43

54
import { IdleManagerComponent } from "./idle-manager.component";
5+
import { provideHttpClient } from "@angular/common/http";
66

77
describe("IdleManagerComponent", () => {
88
let component: IdleManagerComponent;
@@ -11,7 +11,8 @@ describe("IdleManagerComponent", () => {
1111
beforeEach(async () => {
1212
await TestBed.configureTestingModule({
1313
declarations: [IdleManagerComponent],
14-
imports: [NgbModule, HttpClientTestingModule],
14+
imports: [NgbModule],
15+
providers: [provideHttpClient()],
1516
}).compileComponents();
1617
});
1718

packages/portail-usagers/src/app/modules/general/components/not-found/not-found.component.spec.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing";
22

33
import { APP_BASE_HREF } from "@angular/common";
4-
import { HttpClientTestingModule } from "@angular/common/http/testing";
54
import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
65
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
76
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
87
import { NotFoundComponent } from "./not-found.component";
9-
import { RouterTestingModule } from "@angular/router/testing";
8+
import { RouterModule } from "@angular/router";
9+
import { provideHttpClient } from "@angular/common/http";
1010

1111
describe("NotFoundComponent", () => {
1212
let component: NotFoundComponent;
@@ -19,11 +19,12 @@ describe("NotFoundComponent", () => {
1919
NgbModule,
2020
ReactiveFormsModule,
2121
FormsModule,
22-
23-
HttpClientTestingModule,
24-
RouterTestingModule,
22+
RouterModule.forRoot([]),
23+
],
24+
providers: [
25+
provideHttpClient(),
26+
{ provide: APP_BASE_HREF, useValue: "/" },
2527
],
26-
providers: [{ provide: APP_BASE_HREF, useValue: "/" }],
2728
schemas: [CUSTOM_ELEMENTS_SCHEMA],
2829
}).compileComponents();
2930
}));

0 commit comments

Comments
 (0)