diff --git a/src/app/theme/theme-designer/theme-designer.component.spec.ts b/src/app/theme/theme-designer/theme-designer.component.spec.ts index 1ba0ccd..8371627 100644 --- a/src/app/theme/theme-designer/theme-designer.component.spec.ts +++ b/src/app/theme/theme-designer/theme-designer.component.spec.ts @@ -1,12 +1,11 @@ import { NO_ERRORS_SCHEMA } from '@angular/core' import { ComponentFixture, TestBed, fakeAsync, tick, waitForAsync } from '@angular/core/testing' -import { HttpResponse, HttpErrorResponse } from '@angular/common/http' -import { HttpClientTestingModule } from '@angular/common/http/testing' +import { HttpResponse, HttpErrorResponse, provideHttpClient } from '@angular/common/http' +import { provideHttpClientTesting } from '@angular/common/http/testing' import { By } from '@angular/platform-browser' import { BrowserAnimationsModule } from '@angular/platform-browser/animations' import { FormsModule, ReactiveFormsModule } from '@angular/forms' -import { ActivatedRoute, Router } from '@angular/router' -import { RouterTestingModule } from '@angular/router/testing' +import { ActivatedRoute, provideRouter, Router } from '@angular/router' import { TranslateService } from '@ngx-translate/core' import { TranslateTestingModule } from 'ngx-translate-testing' import { of, throwError } from 'rxjs' @@ -19,11 +18,11 @@ import { OverlayPanelModule } from 'primeng/overlaypanel' import { ConfirmDialog, ConfirmDialogModule } from 'primeng/confirmdialog' import { PortalMessageService, ThemeService } from '@onecx/portal-integration-angular' +import { CurrentThemeTopic } from '@onecx/integration-interface' import { RefType, ThemesAPIService, ImagesInternalAPIService } from 'src/app/shared/generated' import { themeVariables } from './theme-variables' import { ThemeDesignerComponent } from './theme-designer.component' -import { CurrentThemeTopic } from '@onecx/integration-interface' describe('ThemeDesignerComponent', () => { let component: ThemeDesignerComponent @@ -64,10 +63,8 @@ describe('ThemeDesignerComponent', () => { DropdownModule, FormsModule, InputSwitchModule, - HttpClientTestingModule, OverlayPanelModule, ReactiveFormsModule, - RouterTestingModule, TranslateTestingModule.withTranslations({ de: require('src/assets/i18n/de.json'), en: require('src/assets/i18n/en.json') @@ -75,6 +72,9 @@ describe('ThemeDesignerComponent', () => { ], schemas: [NO_ERRORS_SCHEMA], providers: [ + provideHttpClientTesting(), + provideHttpClient(), + provideRouter([{ path: '', component: ThemeDesignerComponent }]), { provide: PortalMessageService, useValue: msgServiceSpy }, { provide: ThemeService, useValue: themeServiceSpy }, { provide: ThemesAPIService, useValue: themeApiSpy }, diff --git a/src/app/theme/theme-detail/theme-detail.component.spec.ts b/src/app/theme/theme-detail/theme-detail.component.spec.ts index 572fbf2..830998c 100644 --- a/src/app/theme/theme-detail/theme-detail.component.spec.ts +++ b/src/app/theme/theme-detail/theme-detail.component.spec.ts @@ -1,10 +1,9 @@ import { NO_ERRORS_SCHEMA } from '@angular/core' import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing' import { Location } from '@angular/common' -import { HttpErrorResponse } from '@angular/common/http' -import { HttpClientTestingModule } from '@angular/common/http/testing' -import { ActivatedRoute, Router } from '@angular/router' -import { RouterTestingModule } from '@angular/router/testing' +import { provideHttpClientTesting } from '@angular/common/http/testing' +import { HttpErrorResponse, provideHttpClient } from '@angular/common/http' +import { ActivatedRoute, provideRouter, Router } from '@angular/router' import { TranslateModule, TranslateService } from '@ngx-translate/core' import { TranslateTestingModule } from 'ngx-translate-testing' import { of, throwError } from 'rxjs' @@ -43,8 +42,6 @@ describe('ThemeDetailComponent', () => { TestBed.configureTestingModule({ declarations: [ThemeDetailComponent], imports: [ - RouterTestingModule, - HttpClientTestingModule, TranslateModule.forRoot(), TranslateTestingModule.withTranslations({ de: require('src/assets/i18n/de.json'), @@ -52,6 +49,9 @@ describe('ThemeDetailComponent', () => { }).withDefaultLanguage('de') ], providers: [ + provideHttpClientTesting(), + provideHttpClient(), + provideRouter([{ path: '', component: ThemeDetailComponent }]), { provide: UserService, useValue: mockUserService }, { provide: PortalMessageService, useValue: msgServiceSpy }, { provide: ConfigurationService, useValue: configServiceSpy }, diff --git a/src/app/theme/theme-import/theme-import.component.spec.ts b/src/app/theme/theme-import/theme-import.component.spec.ts index 8a35873..4e5a071 100644 --- a/src/app/theme/theme-import/theme-import.component.spec.ts +++ b/src/app/theme/theme-import/theme-import.component.spec.ts @@ -1,8 +1,8 @@ import { NO_ERRORS_SCHEMA } from '@angular/core' import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing' -import { HttpClientTestingModule } from '@angular/common/http/testing' -import { Router } from '@angular/router' -import { RouterTestingModule } from '@angular/router/testing' +import { HttpResponse, provideHttpClient } from '@angular/common/http' +import { provideHttpClientTesting } from '@angular/common/http/testing' +import { provideRouter, Router } from '@angular/router' import { TranslateTestingModule } from 'ngx-translate-testing' import { of, throwError } from 'rxjs' @@ -10,7 +10,6 @@ import { PortalMessageService } from '@onecx/portal-integration-angular' import { ThemesAPIService } from 'src/app/shared/generated' import { ThemeImportComponent } from './theme-import.component' -import { HttpResponse } from '@angular/common/http' describe('ThemeImportComponent', () => { let component: ThemeImportComponent @@ -24,14 +23,15 @@ describe('ThemeImportComponent', () => { TestBed.configureTestingModule({ declarations: [ThemeImportComponent], imports: [ - RouterTestingModule, - HttpClientTestingModule, TranslateTestingModule.withTranslations({ de: require('src/assets/i18n/de.json'), en: require('src/assets/i18n/en.json') }).withDefaultLanguage('en') ], providers: [ + provideHttpClientTesting(), + provideHttpClient(), + provideRouter([{ path: '', component: ThemeImportComponent }]), { provide: PortalMessageService, useValue: msgServiceSpy }, { provide: ThemesAPIService, useValue: themeApiSpy } ], diff --git a/src/app/theme/theme-search/theme-search.component.spec.ts b/src/app/theme/theme-search/theme-search.component.spec.ts index e5e8204..c6aaa45 100644 --- a/src/app/theme/theme-search/theme-search.component.spec.ts +++ b/src/app/theme/theme-search/theme-search.component.spec.ts @@ -1,8 +1,8 @@ -import { HttpClientTestingModule } from '@angular/common/http/testing' import { NO_ERRORS_SCHEMA } from '@angular/core' import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing' -import { Router } from '@angular/router' -import { RouterTestingModule } from '@angular/router/testing' +import { provideHttpClient } from '@angular/common/http' +import { provideHttpClientTesting } from '@angular/common/http/testing' +import { provideRouter, Router } from '@angular/router' import { TranslateService } from '@ngx-translate/core' import { TranslateTestingModule } from 'ngx-translate-testing' import { DataViewModule } from 'primeng/dataview' @@ -21,15 +21,18 @@ describe('ThemeSearchComponent', () => { TestBed.configureTestingModule({ declarations: [ThemeSearchComponent], imports: [ - RouterTestingModule, - HttpClientTestingModule, DataViewModule, TranslateTestingModule.withTranslations({ de: require('src/assets/i18n/de.json'), en: require('src/assets/i18n/en.json') }).withDefaultLanguage('en') ], - providers: [{ provide: ThemesAPIService, useValue: themeApiSpy }], + providers: [ + provideHttpClientTesting(), + provideHttpClient(), + provideRouter([{ path: '', component: ThemeSearchComponent }]), + { provide: ThemesAPIService, useValue: themeApiSpy } + ], schemas: [NO_ERRORS_SCHEMA] }).compileComponents() }))