Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What value to give void properties

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}/>);
    });    
});

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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}/>);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading