makeExternalCacheProvider()
declare const makeExternalCacheProvider: (
managers: Manager[],
initialState?: State<unknown>,
) => ({ children }: { children: React.ReactNode }) => JSX.Element;
Used to build a <ExternalCacheProvider /> for makeRenderRestHook()
Internally constructs a redux store attaching the middlwares.
Arguments
managers
initialState
Can be used to prime the cache if test expects cache values to already be filled.
Returns
Simple wrapper component that only has child as prop.
const manager = new MockNetworkManager();
const subscriptionManager = new SubscriptionManager(PollingSubscription);
const Provider = makeExternalCacheProvider([manager, subscriptionManager]);
function renderRestHook<T>(callback: () => T) {
return renderHook(callback, {
wrapper: ({ children }) => <Provider>{children}</Provider>,
});
}