All files / src/app/core/store/content/viewcontexts viewcontexts.selectors.ts

76.92% Statements 10/13
100% Branches 0/0
25% Functions 1/4
72.72% Lines 8/11

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 2119x     19x 19x   19x   19x   19x   19x           19x    
import { createSelector } from '@ngrx/store';
 
import { CallParameters } from 'ish-core/models/call-parameters/call-parameters.model';
import { createContentPageletEntryPointView } from 'ish-core/models/content-view/content-view.model';
import { getContentState } from 'ish-core/store/content/content-store';
 
import { serializeContextSpecificViewContextId, viewcontextsAdapter } from './viewcontexts.reducer';
 
const getViewcontextsState = createSelector(getContentState, state => state.viewcontexts);
 
export const { selectEntities: getViewContextEntities } = viewcontextsAdapter.getSelectors(getViewcontextsState);
 
const getViewContextMemoized = (viewContextId: string, callParameters: CallParameters) =>
  createSelector(
    getViewContextEntities,
    entities => entities[serializeContextSpecificViewContextId(viewContextId, callParameters)]
  );
 
export const getViewContext = (viewContextId: string, callParameters: CallParameters) =>
  createSelector(getViewContextMemoized(viewContextId, callParameters), createContentPageletEntryPointView);