From 5c6a45349adfc523dc8c946adb7eda70fa4ea7cb Mon Sep 17 00:00:00 2001 From: Brent Kimmel Date: Wed, 24 Jun 2020 16:29:15 -0400 Subject: [PATCH] R Austin Review: more logic in selector --- .../public/resolver/store/data/graphing.test.ts | 8 ++++---- .../public/resolver/store/data/selectors.ts | 7 +++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/security_solution/public/resolver/store/data/graphing.test.ts b/x-pack/plugins/security_solution/public/resolver/store/data/graphing.test.ts index ca03e9d368059f..163846e0414dbf 100644 --- a/x-pack/plugins/security_solution/public/resolver/store/data/graphing.test.ts +++ b/x-pack/plugins/security_solution/public/resolver/store/data/graphing.test.ts @@ -221,7 +221,7 @@ describe('resolver graph with too much lineage', () => { }); describe('should select from state properly', () => { - it('has the correct ancestor cursor', () => { + it('should indicate there are too many ancestors', () => { const action: DataAction = { type: 'serverReturnedResolverData', payload: { @@ -232,9 +232,9 @@ describe('resolver graph with too much lineage', () => { }; store.dispatch(action); const { ancestors } = limitsReached(store.getState()); - expect(ancestors).toEqual(ancestorCursor); + expect(ancestors).toEqual(true); }); - it('has the correct children cursor', () => { + it('should indicate there are too many children', () => { const action: DataAction = { type: 'serverReturnedResolverData', payload: { @@ -245,7 +245,7 @@ describe('resolver graph with too much lineage', () => { }; store.dispatch(action); const { children } = limitsReached(store.getState()); - expect(children).toEqual(childrenCursor); + expect(children).toEqual(true); }); }); }); diff --git a/x-pack/plugins/security_solution/public/resolver/store/data/selectors.ts b/x-pack/plugins/security_solution/public/resolver/store/data/selectors.ts index f26642208e159b..ba415e6d83c8d7 100644 --- a/x-pack/plugins/security_solution/public/resolver/store/data/selectors.ts +++ b/x-pack/plugins/security_solution/public/resolver/store/data/selectors.ts @@ -535,6 +535,9 @@ export const processNodePositionsAndEdgeLineSegments = createSelector( * * @param state {DataState} the DataState from the reducer */ -export const limitsReached = (state: DataState) => { - return state.lineageLimits; +export const limitsReached = (state: DataState): { children: boolean; ancestors: boolean } => { + return { + children: state.lineageLimits.children !== null, + ancestors: state.lineageLimits.ancestors !== null, + }; };