diff --git a/projects/aca-content/src/lib/components/dl-custom-components/datatable-cell-badges/datatable-cell-badges.component.spec.ts b/projects/aca-content/src/lib/components/dl-custom-components/datatable-cell-badges/datatable-cell-badges.component.spec.ts index acc44bf0c..767b763cd 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/datatable-cell-badges/datatable-cell-badges.component.spec.ts +++ b/projects/aca-content/src/lib/components/dl-custom-components/datatable-cell-badges/datatable-cell-badges.component.spec.ts @@ -32,7 +32,7 @@ import { NodeEntry } from '@alfresco/js-api'; import { of } from 'rxjs'; import { By } from '@angular/platform-browser'; import { ContentActionType } from '@alfresco/adf-extensions'; -import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; +import { HttpClientModule } from '@angular/common/http'; import { StoreModule } from '@ngrx/store'; const mockNode = { @@ -59,6 +59,7 @@ describe('DatatableCellBadgesComponent', () => { imports: [ TranslateModule.forRoot(), AuthModule.forRoot(), + HttpClientModule, StoreModule.forRoot( { app: (state) => state }, { @@ -75,7 +76,7 @@ describe('DatatableCellBadgesComponent', () => { } ) ], - providers: [Actions, provideHttpClient(withInterceptorsFromDi())] + providers: [Actions] }); fixture = TestBed.createComponent(DatatableCellBadgesComponent); diff --git a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts index a0a6e3ddf..c9d93f7c8 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts +++ b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts @@ -26,7 +26,7 @@ import { CustomNameColumnComponent } from './name-column.component'; import { Actions } from '@ngrx/effects'; import { StoreModule } from '@ngrx/store'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; +import { HttpClientModule } from '@angular/common/http'; import { TranslateModule } from '@ngx-translate/core'; import { By } from '@angular/platform-browser'; import { AuthModule } from '@alfresco/adf-core'; @@ -49,6 +49,7 @@ describe('CustomNameColumnComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ imports: [ + HttpClientModule, TranslateModule.forRoot(), CustomNameColumnComponent, MockDatatableCellBadgesComponent, @@ -69,7 +70,7 @@ describe('CustomNameColumnComponent', () => { } ) ], - providers: [Actions, provideHttpClient(withInterceptorsFromDi())] + providers: [Actions] }); fixture = TestBed.createComponent(CustomNameColumnComponent); diff --git a/projects/aca-content/src/lib/components/home/home.component.spec.ts b/projects/aca-content/src/lib/components/home/home.component.spec.ts index 2ed68a78f..86f8043f9 100644 --- a/projects/aca-content/src/lib/components/home/home.component.spec.ts +++ b/projects/aca-content/src/lib/components/home/home.component.spec.ts @@ -25,7 +25,7 @@ import { HomeComponent } from './home.component'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { Router } from '@angular/router'; -import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; +import { HttpClientModule } from '@angular/common/http'; import { RouterTestingModule } from '@angular/router/testing'; import { AppSettingsService } from '@alfresco/aca-shared'; @@ -36,8 +36,7 @@ describe('HomeComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [RouterTestingModule, HomeComponent], - providers: [provideHttpClient(withInterceptorsFromDi())] + imports: [HttpClientModule, RouterTestingModule, HomeComponent] }); appSettings = TestBed.inject(AppSettingsService); spyOnProperty(appSettings, 'landingPage', 'get').and.returnValue('/my-mock-landing-page'); diff --git a/projects/aca-content/src/lib/testing/app-testing.module.ts b/projects/aca-content/src/lib/testing/app-testing.module.ts index 0de256e77..73274f2b6 100644 --- a/projects/aca-content/src/lib/testing/app-testing.module.ts +++ b/projects/aca-content/src/lib/testing/app-testing.module.ts @@ -25,16 +25,16 @@ import { NgModule } from '@angular/core'; import { TranslateModule } from '@ngx-translate/core'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { AuthenticationService, PageTitleService, TranslationMock, TranslationService } from '@alfresco/adf-core'; +import { TranslationService, TranslationMock, AuthenticationService, PageTitleService } from '@alfresco/adf-core'; import { AlfrescoApiService, AlfrescoApiServiceMock, DiscoveryApiService, SearchQueryBuilderService } from '@alfresco/adf-content-services'; import { RepositoryInfo, VersionInfo } from '@alfresco/js-api'; -import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; +import { HttpClientModule } from '@angular/common/http'; import { StoreModule } from '@ngrx/store'; import { appReducer } from '../store/reducers/app.reducer'; import { RouterTestingModule } from '@angular/router/testing'; import { EffectsModule } from '@ngrx/effects'; import { INITIAL_STATE } from '../store/initial-state'; -import { BehaviorSubject, Observable, of, Subject } from 'rxjs'; +import { BehaviorSubject, Observable, Subject, of } from 'rxjs'; import { ContentManagementService } from '../services/content-management.service'; import { DocumentBasePageService } from '@alfresco/aca-shared'; import { MatSnackBarModule } from '@angular/material/snack-bar'; @@ -42,9 +42,9 @@ import { MatDialogModule } from '@angular/material/dialog'; import { MatIconTestingModule } from '@angular/material/icon/testing'; @NgModule({ - exports: [RouterTestingModule, TranslateModule], imports: [ NoopAnimationsModule, + HttpClientModule, RouterTestingModule, TranslateModule.forRoot(), StoreModule.forRoot( @@ -62,6 +62,7 @@ import { MatIconTestingModule } from '@angular/material/icon/testing'; MatDialogModule, MatIconTestingModule ], + exports: [RouterTestingModule, TranslateModule], providers: [ SearchQueryBuilderService, { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }, @@ -97,8 +98,7 @@ import { MatIconTestingModule } from '@angular/material/icon/testing'; { provide: PageTitleService, useValue: {} - }, - provideHttpClient(withInterceptorsFromDi()) + } ] }) export class AppTestingModule {} diff --git a/projects/aca-content/viewer/src/lib/services/viewer.service.spec.ts b/projects/aca-content/viewer/src/lib/services/viewer.service.spec.ts index 1bc82682e..978d8f4fa 100644 --- a/projects/aca-content/viewer/src/lib/services/viewer.service.spec.ts +++ b/projects/aca-content/viewer/src/lib/services/viewer.service.spec.ts @@ -29,7 +29,7 @@ import { FavoritePaging, NodePaging, SharedLinkPaging } from '@alfresco/js-api'; import { ViewerService } from './viewer.service'; import { of } from 'rxjs'; import { TranslateModule } from '@ngx-translate/core'; -import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; +import { HttpClientModule } from '@angular/common/http'; const list = { list: { @@ -69,14 +69,8 @@ describe('ViewerService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot()], - providers: [ - { provide: TranslationService, useClass: TranslationMock }, - ViewerService, - UserPreferencesService, - ContentApiService, - provideHttpClient(withInterceptorsFromDi()) - ] + imports: [TranslateModule.forRoot(), HttpClientModule], + providers: [{ provide: TranslationService, useClass: TranslationMock }, ViewerService, UserPreferencesService, ContentApiService] }); preferences = TestBed.inject(UserPreferencesService); diff --git a/projects/aca-shared/src/lib/routing/plugin-enabled.guard.spec.ts b/projects/aca-shared/src/lib/routing/plugin-enabled.guard.spec.ts index d1129da00..e6b933bca 100644 --- a/projects/aca-shared/src/lib/routing/plugin-enabled.guard.spec.ts +++ b/projects/aca-shared/src/lib/routing/plugin-enabled.guard.spec.ts @@ -26,8 +26,7 @@ import { AppConfigService } from '@alfresco/adf-core'; import { TestBed } from '@angular/core/testing'; import { PluginEnabledGuard } from './plugin-enabled.guard'; import { ActivatedRouteSnapshot, Router, RouterStateSnapshot } from '@angular/router'; -import { provideHttpClientTesting } from '@angular/common/http/testing'; -import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; describe('PluginEnabledGuard', () => { let getSpy: jasmine.Spy<(key: string, defaultValue?: boolean) => boolean>; @@ -35,8 +34,7 @@ describe('PluginEnabledGuard', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [], - providers: [provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()] + imports: [HttpClientTestingModule] }); getSpy = spyOn(TestBed.inject(AppConfigService), 'get'); route = new ActivatedRouteSnapshot(); diff --git a/projects/aca-shared/src/lib/services/app.service.spec.ts b/projects/aca-shared/src/lib/services/app.service.spec.ts index a016de653..6045b503e 100644 --- a/projects/aca-shared/src/lib/services/app.service.spec.ts +++ b/projects/aca-shared/src/lib/services/app.service.spec.ts @@ -26,15 +26,15 @@ import { AppService } from './app.service'; import { TestBed } from '@angular/core/testing'; import { AuthenticationService, - NotificationService, PageTitleService, - StorageService, TranslationMock, TranslationService, - UserPreferencesService + UserPreferencesService, + NotificationService, + StorageService } from '@alfresco/adf-core'; import { BehaviorSubject, Observable, of, Subject } from 'rxjs'; -import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; +import { HttpClientModule } from '@angular/common/http'; import { AlfrescoApiService, AlfrescoApiServiceMock, @@ -73,7 +73,7 @@ describe('AppService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CommonModule, TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), MatDialogModule, MatSnackBarModule], + imports: [CommonModule, HttpClientModule, TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), MatDialogModule, MatSnackBarModule], providers: [ SearchQueryBuilderService, provideMockStore({}), @@ -121,8 +121,7 @@ describe('AppService', () => { setStoragePrefix: () => null, getPropertyKey: (property: string) => `prefix__${property}` } - }, - provideHttpClient(withInterceptorsFromDi()) + } ] }); diff --git a/projects/aca-shared/src/lib/testing/lib-testing-module.ts b/projects/aca-shared/src/lib/testing/lib-testing-module.ts index 205bfb102..a33b4ce78 100644 --- a/projects/aca-shared/src/lib/testing/lib-testing-module.ts +++ b/projects/aca-shared/src/lib/testing/lib-testing-module.ts @@ -27,7 +27,7 @@ import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { TranslateLoaderService, TranslationMock, TranslationService } from '@alfresco/adf-core'; import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; -import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; +import { HttpClientModule } from '@angular/common/http'; import { RouterTestingModule } from '@angular/router/testing'; import { EffectsModule } from '@ngrx/effects'; import { StoreModule } from '@ngrx/store'; @@ -93,10 +93,10 @@ export class DocumentBasePageServiceMock extends DocumentBasePageService { } @NgModule({ - exports: [TranslateModule], imports: [ NoopAnimationsModule, CommonModule, + HttpClientModule, RouterTestingModule, MatIconTestingModule, StoreModule, @@ -119,10 +119,10 @@ export class DocumentBasePageServiceMock extends DocumentBasePageService { } }) ], + exports: [TranslateModule], providers: [ { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }, - { provide: TranslationService, useClass: TranslationMock }, - provideHttpClient(withInterceptorsFromDi()) + { provide: TranslationService, useClass: TranslationMock } ] }) export class LibTestingModule {}