mardi 17 novembre 2020

How to mock a wrapper component that incorporates a Recoil function inside it?

This is for a react native project, while writing test's using Jest. I have a wrapper component that returns a wrapped component incorporating a recoil method within it passed on to the child. While testing getting the following error


TypeError: (0 , _recoilReactNative.isRecoilValue) is not a function


The wrapper code would be

import React  from 'react';
import { useRecoilState, isRecoilValue } from "recoil-react-native";

const Wrapper = (WrappedComponent) => (props) => {
         
    return <WrappedComponent isRecoilValue ={isRecoilValue} {...props}/>;
}

Any suggestion would be helpful

Aucun commentaire:

Enregistrer un commentaire