All files / src/app/extensions/store-locator/store store-locator-store.module.ts

100% Statements 13/13
100% Branches 0/0
100% Functions 1/1
100% Lines 12/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 302x 2x 2x 2x   2x 2x   2x 2x   2x         2x               2x   7x      
import { NgModule, Type } from '@angular/core';
import { EffectsModule } from '@ngrx/effects';
import { ActionReducerMap, StoreModule } from '@ngrx/store';
import { pick } from 'lodash-es';
 
import { StoreLocatorConfigEffects } from './store-locator-config/store-locator-config.effects';
import { storeLocatorConfigReducer } from './store-locator-config/store-locator-config.reducer';
import { StoreLocatorState } from './store-locator-store';
import { StoresEffects } from './stores/stores.effects';
import { storesReducer } from './stores/stores.reducer';
 
const storeLocatorReducers: ActionReducerMap<StoreLocatorState> = {
  stores: storesReducer,
  storeLocatorConfig: storeLocatorConfigReducer,
};
 
const storeLocatorEffects: Type<unknown>[] = [StoresEffects, StoreLocatorConfigEffects];
 
@NgModule({
  imports: [
    EffectsModule.forFeature(storeLocatorEffects),
    StoreModule.forFeature('storeLocator', storeLocatorReducers),
  ],
})
export class StoreLocatorStoreModule {
  static forTesting(...reducers: (keyof ActionReducerMap<StoreLocatorState>)[]) {
    return StoreModule.forFeature('storeLocator', pick(storeLocatorReducers, reducers));
  }
}