I want to test a React class component.
Let's say I have a method in my class that computes something based on the current state and props.
import Component from './Component'
const wrapper = enzyme.shallow(<Component {...props} />);
it('does something', () => {
expect(wrapper.instance().someInstanceMethod(input)).toBe(true);
});
Typescript says Property 'someInstanceMethod' is not defined on type Component<any, any>
. How can I tell Typscript how my class is looking and what methods it has?
Is there a good example for this?