All files / src/app/extensions/store-locator/store/stores stores.selectors.ts

93.33% Statements 14/15
50% Branches 1/2
80% Functions 4/5
100% Lines 11/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 21 22 23 244x   4x   4x   5x   4x   4x   4x   4x   4x   4x     1x    
import { createSelector } from '@ngrx/store';
 
import { getStoreLocatorState } from '../store-locator-store';
 
import { initialState, storesAdapter } from './stores.reducer';
 
const getStoresState = createSelector(getStoreLocatorState, state => state?.stores ?? initialState);
 
const { selectEntities, selectAll } = storesAdapter.getSelectors(getStoresState);
 
export const getStores = selectAll;
 
export const getLoading = createSelector(getStoresState, state => state.loading);
 
export const getError = createSelector(getStoresState, state => state.error);
 
const getHighlightedStoreId = createSelector(getStoresState, state => state.highlighted);
 
export const getHighlightedStore = createSelector(
  selectEntities,
  getHighlightedStoreId,
  (entities, highlightedId) => entities[highlightedId]
);