Angular strict mode, Ngrx, Jamsmine: mock selector with props

Viewed 216

I am currently trying to remove the deprecated selectors in my application. This github issue telling us to declare selector with props as a function.

Old way (deprecated):

export const getCurrentScope = createSelector(getContextState, (state: ContextState, arg: string) => {
   return state.object + arg;
}

New Way:

export const getCurrentScope = (arg: string) => createSelector(getContextState, (state: ContextState) => {
   return state.object + arg;
}

With the deprecated method I was able to mock the selector by overriding it with the overrideSelector function.

Now that getCurrentScope is no longer a selector I cannot use the overrideSelector function.

So I'm trying to mock the function as follow:

import * as contextSelector from '@core/store/selectors/context.selectors';
spyOn(contextSelector, 'getCurrentScope').and.returnValue( ??? );

As I'm working with Angular Strict Mode, I have to return a MemoizedSelector but I do not find any way to perform it.

Can someone help me on this ?

0 Answers
Related