Skip to content

Commit 2f28805

Browse files
committed
Angular version 18 update
1 parent c159616 commit 2f28805

File tree

53 files changed

+5114
-3716
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+5114
-3716
lines changed

package-lock.json

+4,668-3,309
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@
2121
},
2222
"private": true,
2323
"dependencies": {
24-
"@angular-devkit/build-angular": "^17.3.8",
24+
"@angular-devkit/build-angular": "^18.2.12",
2525
"@angular-eslint/schematics": "^17.5.1",
26-
"@angular/animations": "^17.3.10",
27-
"@angular/cli": "^17.3.8",
28-
"@angular/common": "^17.3.10",
29-
"@angular/compiler": "^17.3.10",
30-
"@angular/compiler-cli": "^17.3.10",
31-
"@angular/core": "^17.3.10",
32-
"@angular/forms": "^17.3.10",
33-
"@angular/platform-browser": "^17.3.10",
34-
"@angular/platform-browser-dynamic": "^17.3.10",
35-
"@angular/router": "^17.3.10",
26+
"@angular/animations": "^18.2.13",
27+
"@angular/cli": "^18.2.12",
28+
"@angular/common": "^18.2.13",
29+
"@angular/compiler": "^18.2.13",
30+
"@angular/compiler-cli": "^18.2.13",
31+
"@angular/core": "^18.2.13",
32+
"@angular/forms": "^18.2.13",
33+
"@angular/platform-browser": "^18.2.13",
34+
"@angular/platform-browser-dynamic": "^18.2.13",
35+
"@angular/router": "^18.2.13",
3636
"@auth0/angular-jwt": "^5.1.0",
3737
"@rxweb/reactive-form-validators": "^2.1.6",
3838
"@sentry/angular": "^8.18.0",
@@ -50,7 +50,7 @@
5050
"ts-cacheable": "^1.0.8",
5151
"tslib": "^2.3.0",
5252
"typescript": "~5.4.5",
53-
"zone.js": "~0.14.6"
53+
"zone.js": "~0.14.10"
5454
},
5555
"devDependencies": {
5656
"@angular-eslint/builder": "14.1.2",

src/app/app.module.ts

+43-49
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
55
import { AppRoutingModule } from './app-routing.module';
66
import { AppComponent } from './app.component';
77

8-
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
8+
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
99

1010
// External Libraries
1111
import { IconSpriteModule } from 'ng-svg-icon-sprite';
@@ -22,52 +22,46 @@ import { Sage300ConfigurationModule } from './integrations/sage300/sage300-main/
2222
import * as Sentry from "@sentry/angular";
2323
import { Router } from '@angular/router';
2424

25-
@NgModule({
26-
declarations: [
27-
AppComponent
28-
],
29-
imports: [
30-
BrowserModule,
31-
AppRoutingModule,
32-
BrowserAnimationsModule,
33-
HttpClientModule,
34-
ToastModule,
35-
SharedModule,
36-
RippleModule,
37-
IconSpriteModule.forRoot({ path: 'assets/sprites/sprite.svg' }),
38-
Sage300ConfigurationModule
39-
],
40-
providers: [
41-
MessageService,
42-
{
43-
provide: JWT_OPTIONS,
44-
useValue: JWT_OPTIONS
45-
},
46-
JwtHelperService,
47-
{
48-
provide: HTTP_INTERCEPTORS,
49-
useClass: JwtInterceptor,
50-
multi: true
51-
},
52-
{
53-
provide: ErrorHandler,
54-
useClass: GlobalErrorHandler
55-
},
56-
{
57-
provide: ErrorHandler,
58-
useValue: Sentry.createErrorHandler()
59-
},
60-
{
61-
provide: Sentry.TraceService,
62-
deps: [Router]
63-
},
64-
{
65-
provide: APP_INITIALIZER,
66-
useFactory: (brandingService: BrandingService) => () => brandingService.init(),
67-
deps: [BrandingService, Sentry.TraceService],
68-
multi: true
69-
}
70-
],
71-
bootstrap: [AppComponent]
72-
})
25+
@NgModule({ declarations: [
26+
AppComponent
27+
],
28+
bootstrap: [AppComponent], imports: [BrowserModule,
29+
AppRoutingModule,
30+
BrowserAnimationsModule,
31+
ToastModule,
32+
SharedModule,
33+
RippleModule,
34+
IconSpriteModule.forRoot({ path: 'assets/sprites/sprite.svg' }),
35+
Sage300ConfigurationModule], providers: [
36+
MessageService,
37+
{
38+
provide: JWT_OPTIONS,
39+
useValue: JWT_OPTIONS
40+
},
41+
JwtHelperService,
42+
{
43+
provide: HTTP_INTERCEPTORS,
44+
useClass: JwtInterceptor,
45+
multi: true
46+
},
47+
{
48+
provide: ErrorHandler,
49+
useClass: GlobalErrorHandler
50+
},
51+
{
52+
provide: ErrorHandler,
53+
useValue: Sentry.createErrorHandler()
54+
},
55+
{
56+
provide: Sentry.TraceService,
57+
deps: [Router]
58+
},
59+
{
60+
provide: APP_INITIALIZER,
61+
useFactory: (brandingService: BrandingService) => () => brandingService.init(),
62+
deps: [BrandingService, Sentry.TraceService],
63+
multi: true
64+
},
65+
provideHttpClient(withInterceptorsFromDi())
66+
] })
7367
export class AppModule { }

src/app/auth/login/login.component.spec.ts

+15-16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { HttpClientModule } from '@angular/common/http';
1+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
22
import { ComponentFixture, TestBed } from '@angular/core/testing';
33
import { ActivatedRoute, Router } from '@angular/router';
44
import { RouterTestingModule } from '@angular/router/testing';
@@ -23,23 +23,22 @@ xdescribe('LoginComponent', () => {
2323

2424
beforeEach(async () => {
2525
await TestBed.configureTestingModule({
26-
imports: [
27-
HttpClientModule, RouterTestingModule
28-
],
29-
declarations: [ LoginComponent ],
30-
providers: [
26+
declarations: [LoginComponent],
27+
imports: [RouterTestingModule],
28+
providers: [
3129
{
32-
provide: ActivatedRoute,
33-
useValue: {
34-
queryParams: of({
35-
code: 'dummy-auth-code'
36-
})
37-
}
30+
provide: ActivatedRoute,
31+
useValue: {
32+
queryParams: of({
33+
code: 'dummy-auth-code'
34+
})
35+
}
3836
},
39-
{ provide: AuthService, useValue: service1},
40-
{ provide: Router, useValue: routerSpy }
41-
]
42-
})
37+
{ provide: AuthService, useValue: service1 },
38+
{ provide: Router, useValue: routerSpy },
39+
provideHttpClient(withInterceptorsFromDi())
40+
]
41+
})
4342
.compileComponents();
4443

4544
fixture = TestBed.createComponent(LoginComponent);

src/app/core/guard/auth.guard.spec.ts

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { TestBed } from '@angular/core/testing';
22
import { RouterTestingModule } from '@angular/router/testing';
3-
import { HttpClientModule } from '@angular/common/http';
3+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
44
import { AuthGuard } from './auth.guard';
55
import { AuthService } from '../services/common/auth.service';
66
import { Router } from '@angular/router';
@@ -19,12 +19,13 @@ describe('AuthGuard', () => {
1919
};
2020

2121
TestBed.configureTestingModule({
22-
imports: [RouterTestingModule, HttpClientModule],
23-
providers: [
24-
{provide: AuthService, useValue: service1},
25-
{provide: Router, useValue: router}
26-
]
27-
});
22+
imports: [RouterTestingModule],
23+
providers: [
24+
{ provide: AuthService, useValue: service1 },
25+
{ provide: Router, useValue: router },
26+
provideHttpClient(withInterceptorsFromDi())
27+
]
28+
});
2829

2930
authService = TestBed.inject(AuthService);
3031
guard = TestBed.inject(AuthGuard);

src/app/core/interceptor/jwt.interceptor.spec.ts

+16-14
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { getTestBed, inject, TestBed } from '@angular/core/testing';
22
import { JwtHelperService, JWT_OPTIONS } from '@auth0/angular-jwt';
3-
import { HttpClient, HttpRequest, HTTP_INTERCEPTORS } from '@angular/common/http';
3+
import { HttpClient, HttpRequest, HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
44
import { JwtInterceptor } from './jwt.interceptor';
5-
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
5+
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
66
import { environment } from 'src/environments/environment';
77
import { ApiService } from '../services/common/api.service';
88
import { Observable, of } from 'rxjs';
@@ -29,26 +29,28 @@ xdescribe('JwtInterceptor', () => {
2929
};
3030

3131
TestBed.configureTestingModule({
32-
imports: [HttpClientTestingModule],
33-
providers: [
32+
imports: [],
33+
providers: [
3434
ApiService, JwtHelperService,
3535
{
36-
provide: HTTP_INTERCEPTORS,
37-
useClass: JwtInterceptor,
38-
multi: true
36+
provide: HTTP_INTERCEPTORS,
37+
useClass: JwtInterceptor,
38+
multi: true
3939
},
4040
{
41-
provide: JWT_OPTIONS,
42-
useValue: JWT_OPTIONS
41+
provide: JWT_OPTIONS,
42+
useValue: JWT_OPTIONS
4343
},
4444
{
45-
provide: AuthService,
46-
useValue: service1
45+
provide: AuthService,
46+
useValue: service1
4747
},
4848
JwtInterceptor,
49-
JwtHelperService
50-
]
51-
});
49+
JwtHelperService,
50+
provideHttpClient(withInterceptorsFromDi()),
51+
provideHttpClientTesting()
52+
]
53+
});
5254

5355
injector = getTestBed();
5456
client = TestBed.inject(HttpClient);

src/app/core/interceptor/jwt.interceptor.ts

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
import { Injectable } from '@angular/core';
2-
import {
3-
HttpRequest,
4-
HttpHandler,
5-
HttpEvent,
6-
HttpInterceptor,
7-
HttpErrorResponse
8-
} from '@angular/common/http';
2+
import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor, HttpErrorResponse } from '@angular/common/http';
93

104
import { BehaviorSubject, Observable, of, throwError } from 'rxjs';
115
import { catchError, filter, map, switchMap, take } from 'rxjs/operators';

src/app/core/services/bamboo-hr/bamboo-hr.service.spec.ts

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
1+
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
22
import { getTestBed, TestBed } from '@angular/core/testing';
33
import { environment } from 'src/environments/environment';
44
import { OrgService } from '../org/org.service';
55
import { bambooHRMockConfiguration, bambooHRMockConfigurationPayload, bambooHRMockConnectionPayload, bambooHrMockData } from './bamboo-hr.fixture';
66

77
import { BambooHrService } from './bamboo-hr.service';
8+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
89

910
xdescribe('BambooHrService', () => {
1011
let service: BambooHrService;
@@ -18,13 +19,13 @@ xdescribe('BambooHrService', () => {
1819

1920
beforeEach(() => {
2021
TestBed.configureTestingModule({
21-
imports: [
22-
HttpClientTestingModule
23-
],
24-
providers: [
25-
{ provide: OrgService, useValue: service1 }
26-
]
27-
});
22+
imports: [],
23+
providers: [
24+
{ provide: OrgService, useValue: service1 },
25+
provideHttpClient(withInterceptorsFromDi()),
26+
provideHttpClientTesting()
27+
]
28+
});
2829
injector = getTestBed();
2930
service = TestBed.inject(BambooHrService);
3031
orgService = injector.inject(OrgService);

src/app/core/services/common/api.service.spec.ts

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { getTestBed, TestBed } from '@angular/core/testing';
22

3-
import { HttpTestingController, HttpClientTestingModule } from '@angular/common/http/testing';
3+
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
44
import { environment } from 'src/environments/environment';
55
import { ApiService } from './api.service';
6-
import { HttpErrorResponse, HttpEventType, HttpHeaders } from '@angular/common/http';
6+
import { HttpErrorResponse, HttpEventType, HttpHeaders, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
77
import { Observable } from 'rxjs';
88

99
xdescribe('ApiService', () => {
@@ -19,11 +19,13 @@ xdescribe('ApiService', () => {
1919

2020
beforeEach(() => {
2121
TestBed.configureTestingModule({
22-
imports: [HttpClientTestingModule],
23-
providers: [
24-
ApiService
25-
]
26-
});
22+
imports: [],
23+
providers: [
24+
ApiService,
25+
provideHttpClient(withInterceptorsFromDi()),
26+
provideHttpClientTesting()
27+
]
28+
});
2729
injector = getTestBed();
2830
service = injector.inject(ApiService);
2931
httpMock = injector.inject(HttpTestingController);

src/app/core/services/common/auth.service.spec.ts

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { getTestBed, TestBed } from '@angular/core/testing';
22
import { AuthService } from './auth.service';
3-
import { HttpTestingController, HttpClientTestingModule } from '@angular/common/http/testing';
3+
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
44
import { UserService } from '../misc/user.service';
55
import { environment } from 'src/environments/environment';
66
import { Router } from '@angular/router';
77
import { loginResponse, minimalUser, tokenResponse } from '../../interceptor/jwt.fixture';
8+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
89

910
xdescribe('AuthService', () => {
1011
let service: AuthService;
@@ -21,13 +22,15 @@ xdescribe('AuthService', () => {
2122

2223
beforeEach(() => {
2324
TestBed.configureTestingModule({
24-
imports: [HttpClientTestingModule],
25-
providers: [
25+
imports: [],
26+
providers: [
2627
AuthService,
27-
{ provide: UserService, useValue: service1},
28-
{ provide: Router, useValue: routerSpy }
29-
]
30-
});
28+
{ provide: UserService, useValue: service1 },
29+
{ provide: Router, useValue: routerSpy },
30+
provideHttpClient(withInterceptorsFromDi()),
31+
provideHttpClientTesting()
32+
]
33+
});
3134
injector = getTestBed();
3235
service = injector.inject(AuthService);
3336
userService = injector.inject(UserService);

0 commit comments

Comments
 (0)