diff --git a/modules/store-devtools/spec/integration.spec.ts b/modules/store-devtools/spec/integration.spec.ts new file mode 100644 index 0000000000..23e88d95c0 --- /dev/null +++ b/modules/store-devtools/spec/integration.spec.ts @@ -0,0 +1,41 @@ +import { NgModule } from '@angular/core'; +import { TestBed } from '@angular/core/testing'; +import { StoreModule, Store, ActionsSubject } from '@ngrx/store'; +import { StoreDevtoolsModule, StoreDevtools } from '@ngrx/store-devtools'; + +describe('Devtools Integration', () => { + let store: Store; + + @NgModule({ + imports: [StoreModule.forFeature('a', (state: any, action: any) => state)], + }) + class EagerFeatureModule {} + + @NgModule({ + imports: [ + StoreModule.forRoot({}), + EagerFeatureModule, + StoreDevtoolsModule.instrument(), + ], + }) + class RootModule {} + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [RootModule], + }); + }); + + it('should load the store eagerly', () => { + let error = false; + + try { + let store = TestBed.get(Store); + store.subscribe(); + } catch (e) { + error = true; + } + + expect(error).toBeFalsy(); + }); +}); diff --git a/modules/store/src/store_module.ts b/modules/store/src/store_module.ts index 3d89a6f83e..7ee74e2a9a 100644 --- a/modules/store/src/store_module.ts +++ b/modules/store/src/store_module.ts @@ -41,14 +41,15 @@ import { ScannedActionsSubject, } from './scanned_actions_subject'; import { STATE_PROVIDERS } from './state'; -import { STORE_PROVIDERS } from './store'; +import { STORE_PROVIDERS, Store } from './store'; @NgModule({}) export class StoreRootModule { constructor( actions$: ActionsSubject, reducer$: ReducerObservable, - scannedActions$: ScannedActionsSubject + scannedActions$: ScannedActionsSubject, + store: Store ) {} } @@ -57,7 +58,8 @@ export class StoreFeatureModule implements OnDestroy { constructor( @Inject(STORE_FEATURES) private features: StoreFeature[], @Inject(FEATURE_REDUCERS) private featureReducers: ActionReducerMap[], - private reducerManager: ReducerManager + private reducerManager: ReducerManager, + root: StoreRootModule ) { features .map((feature, index) => {