I'm creating .tsx components with Typescript/React. I want to do some unit tests of the methods inside the React component. Say:
export default class SomeComponent extends React.Component<undefined, SomeComponentState> {
someMethod = (string: someInput) => {
return someInput + someInput;
}
render () .. // etc
}
In a SomeComponent.test.tsx file, how do I import and test the method of someMethod, and not the whole component itself?
I've tried:
import {someMethod} from "./someComponent";
though without luck - it doesn't seem to be invokable, and will throw TS error: "component has no exported member someMethod"