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

95.65% Statements 22/23
100% Branches 0/0
50% Functions 1/2
95.23% Lines 20/21

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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 535x 5x 5x 5x   5x   5x 5x 5x 5x 5x   5x 5x 5x 5x   5x             5x                 5x       5x                 5x   64x      
import { Injectable, InjectionToken, NgModule } from '@angular/core';
import { EffectsModule } from '@ngrx/effects';
import { ActionReducerMap, StoreConfig, StoreModule } from '@ngrx/store';
import { pick } from 'lodash-es';
 
import { resetOnLogoutMeta } from 'ish-core/utils/meta-reducers';
 
import { CxmlConfigurationEffects } from './cxml-configuration/cxml-configuration.effects';
import { cxmlConfigurationReducer } from './cxml-configuration/cxml-configuration.reducer';
import { OciConfigurationEffects } from './oci-configuration/oci-configuration.effects';
import { ociConfigurationReducer } from './oci-configuration/oci-configuration.reducer';
import { PunchoutFunctionsEffects } from './punchout-functions/punchout-functions.effects';
import { PunchoutState } from './punchout-store';
import { PunchoutTypesEffects } from './punchout-types/punchout-types.effects';
import { punchoutTypesReducer } from './punchout-types/punchout-types.reducer';
import { PunchoutUsersEffects } from './punchout-users/punchout-users.effects';
import { punchoutUsersReducer } from './punchout-users/punchout-users.reducer';
 
const punchoutReducers: ActionReducerMap<PunchoutState> = {
  ociConfiguration: ociConfigurationReducer,
  punchoutUsers: punchoutUsersReducer,
  punchoutTypes: punchoutTypesReducer,
  cxmlConfiguration: cxmlConfigurationReducer,
};
 
const punchoutEffects = [
  OciConfigurationEffects,
  PunchoutUsersEffects,
  PunchoutFunctionsEffects,
  PunchoutTypesEffects,
  CxmlConfigurationEffects,
];
 
@Injectable()
export class PunchoutStoreConfig implements StoreConfig<PunchoutState> {
  metaReducers = [resetOnLogoutMeta];
}
 
export const PUNCHOUT_STORE_CONFIG = new InjectionToken<StoreConfig<PunchoutState>>('punchoutStoreConfig');
 
@NgModule({
  imports: [
    EffectsModule.forFeature(punchoutEffects),
    StoreModule.forFeature('punchout', punchoutReducers, PUNCHOUT_STORE_CONFIG),
  ],
  providers: [{ provide: PUNCHOUT_STORE_CONFIG, useClass: PunchoutStoreConfig }],
})
export class PunchoutStoreModule {
  static forTesting(...reducers: (keyof ActionReducerMap<PunchoutState>)[]) {
    return StoreModule.forFeature('punchout', pick(punchoutReducers, reducers));
  }
}