diff --git a/src/app/core/store/core/configuration/configuration.effects.spec.ts b/src/app/core/store/core/configuration/configuration.effects.spec.ts index a4b7a1886c..3525d813b8 100644 --- a/src/app/core/store/core/configuration/configuration.effects.spec.ts +++ b/src/app/core/store/core/configuration/configuration.effects.spec.ts @@ -1,5 +1,6 @@ import { PLATFORM_ID } from '@angular/core'; import { TestBed } from '@angular/core/testing'; +import { BrowserTransferStateModule } from '@angular/platform-browser'; import { ROOT_EFFECTS_INIT } from '@ngrx/effects'; import { provideMockActions } from '@ngrx/effects/testing'; import { Action } from '@ngrx/store'; @@ -23,7 +24,7 @@ describe('Configuration Effects', () => { translateServiceMock = mock(TranslateService); TestBed.configureTestingModule({ - imports: [CoreStoreModule.forTesting(['configuration'], [ConfigurationEffects])], + imports: [BrowserTransferStateModule, CoreStoreModule.forTesting(['configuration'], [ConfigurationEffects])], providers: [ ConfigurationEffects, { provide: TranslateService, useFactory: () => instance(translateServiceMock) }, diff --git a/src/app/core/store/core/configuration/configuration.effects.ts b/src/app/core/store/core/configuration/configuration.effects.ts index dd051bd20c..f1a4bd2231 100644 --- a/src/app/core/store/core/configuration/configuration.effects.ts +++ b/src/app/core/store/core/configuration/configuration.effects.ts @@ -1,5 +1,5 @@ import { isPlatformBrowser, isPlatformServer } from '@angular/common'; -import { ApplicationRef, Inject, Injectable, Optional, PLATFORM_ID } from '@angular/core'; +import { ApplicationRef, Inject, Injectable, PLATFORM_ID } from '@angular/core'; import { TransferState } from '@angular/platform-browser'; import { Actions, ROOT_EFFECTS_INIT, createEffect, ofType } from '@ngrx/effects'; import { Store, select } from '@ngrx/store'; @@ -23,7 +23,7 @@ export class ConfigurationEffects { private store: Store, private translateService: TranslateService, private stateProperties: StatePropertiesService, - @Optional() private transferState: TransferState, + private transferState: TransferState, @Inject(PLATFORM_ID) private platformId: string, private appRef: ApplicationRef, @Inject(MEDIUM_BREAKPOINT_WIDTH) private mediumBreakpointWidth: number, @@ -42,7 +42,7 @@ export class ConfigurationEffects { setInitialRestEndpoint$ = createEffect(() => iif( - () => !this.transferState || !this.transferState.hasKey(NGRX_STATE_SK), + () => !this.transferState.hasKey(NGRX_STATE_SK), this.actions$.pipe( ofType(ROOT_EFFECTS_INIT), take(1), diff --git a/src/app/core/store/core/configuration/configuration.integration.spec.ts b/src/app/core/store/core/configuration/configuration.integration.spec.ts index f4811e58ce..264a6de703 100644 --- a/src/app/core/store/core/configuration/configuration.integration.spec.ts +++ b/src/app/core/store/core/configuration/configuration.integration.spec.ts @@ -1,6 +1,7 @@ import { Location } from '@angular/common'; -import { Component, PLATFORM_ID } from '@angular/core'; +import { Component } from '@angular/core'; import { TestBed, fakeAsync, tick } from '@angular/core/testing'; +import { BrowserTransferStateModule } from '@angular/platform-browser'; import { Router } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; @@ -34,6 +35,7 @@ describe('Configuration Integration', () => { TestBed.configureTestingModule({ declarations: [DummyComponent], imports: [ + BrowserTransferStateModule, CoreStoreModule.forTesting(['router', 'configuration'], [ConfigurationEffects], [configurationMeta]), RouterTestingModule.withRoutes([ { path: 'home', component: DummyComponent, canActivate: [ConfigurationGuard] }, @@ -42,7 +44,6 @@ describe('Configuration Integration', () => { ], providers: [ provideStoreSnapshots(), - { provide: PLATFORM_ID, useValue: 'server' }, { provide: ConfigurationService, useFactory: () => instance(configurationService) }, { provide: MEDIUM_BREAKPOINT_WIDTH, useValue: 768 }, { provide: LARGE_BREAKPOINT_WIDTH, useValue: 992 },