I have this interface:
interface Props {
close: () => void;
disableButton: () => void;
showPrompt: boolean;
pol: string;
}
I’m trying to use it in a test. My problem is that I don’t know what I should do with close and disableButton. They are just passed to that class so the state can be updated. What value do I give the variables for use in my shallow?
describe('<Reissue />', () => {
it('calls reissue service', () => {
const close = ???;
const disableButton = ???;
const showPrompt = true;
const pol = '123456';
const wrapper = shallow(<Reissue close={} disableButton={} showPrompt={showPrompt} pol={pol}/>);
});
});
>Solution :
close and disableButton are functions so you should pass functions to them, even if empty empty ones –
const wrapper = shallow(<Reissue close={()=>()} disableButton={()=>()} showPrompt={showPrompt} pol={pol}/>);