All files / projects/organization-management/src/app/store organization-management-store.module.ts

95% Statements 19/20
100% Branches 0/0
50% Functions 1/2
94.44% Lines 17/18

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 495x 5x 5x 5x   5x   5x 5x 5x 5x   5x 5x   5x           5x     5x       5x                             5x   91x      
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 { BudgetEffects } from './budget/budget.effects';
import { budgetReducer } from './budget/budget.reducer';
import { CostCentersEffects } from './cost-centers/cost-centers.effects';
import { costCentersReducer } from './cost-centers/cost-centers.reducer';
import { OrganizationManagementState } from './organization-management-store';
import { UsersEffects } from './users/users.effects';
import { usersReducer } from './users/users.reducer';
 
const organizationManagementReducers: ActionReducerMap<OrganizationManagementState> = {
  users: usersReducer,
  costCenters: costCentersReducer,
  budget: budgetReducer,
};
 
const organizationManagementEffects = [UsersEffects, CostCentersEffects, BudgetEffects];
 
@Injectable()
export class DefaultOrganizationManagementStoreConfig implements StoreConfig<OrganizationManagementState> {
  metaReducers = [resetOnLogoutMeta];
}
 
export const ORGANIZATION_MANAGEMENT_STORE_CONFIG = new InjectionToken<StoreConfig<OrganizationManagementState>>(
  'organizationManagementStoreConfig'
);
 
@NgModule({
  imports: [
    EffectsModule.forFeature(organizationManagementEffects),
    StoreModule.forFeature(
      'organizationManagement',
      organizationManagementReducers,
      ORGANIZATION_MANAGEMENT_STORE_CONFIG
    ),
  ],
  providers: [{ provide: ORGANIZATION_MANAGEMENT_STORE_CONFIG, useClass: DefaultOrganizationManagementStoreConfig }],
})
export class OrganizationManagementStoreModule {
  static forTesting(...reducers: (keyof ActionReducerMap<OrganizationManagementState>)[]) {
    return StoreModule.forFeature('organizationManagement', pick(organizationManagementReducers, reducers));
  }
}