All files / @gce/relation/store reselect.js

57.14% Statements 8/14
100% Branches 0/0
37.5% Functions 3/8
66.67% Lines 6/9

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          1x   1x   1x         1x   1x     1x        
import { createSelector } from 'reselect';
import { getModuleState } from 'redux-register-module';
 
import { STATE_KEY } from './constants';
 
export const getInsureds = state => getModuleState(STATE_KEY, state).insureds;
 
export const getLoading = state => getModuleState(STATE_KEY, state).loading;
 
export const getMainInsured = (state) => {
  const insureds = getInsureds(state);
  return insureds.filter(insured => insured.partPrincipal);
};
 
export const getOwnerId = createSelector(
  getInsureds,
  insureds => insureds.find(i => i.partPrincipal).insuredNumber,
);
 
export const getActiveInsureds = createSelector(
  getInsureds,
  insureds => insureds.filter(i => !i.forInformation),
);