I need to mock a component on jest, the component structure is like this:
export class ClassName extends React.Component<ClassNameProps> { static PropOne; static PropTwo; static MethodOne(param: string): void; static MethodTwo(param: string): void;}
Note: Each of those static properties on it, return a different react component. So PropOne is a component
Note 2: I'm not the responsable for this component, and I don't have the permission to change it.
On my mock files, I usually do something like:
export default { ClassName: 'class-name'}
But in this case, I need to mock those sub components as well. I've already tried the following ideas:
ClassName: { PropOne: jest.fn(() => Promise.resolve('')), PropTwo: jest.fn(() => Promise.resolve('')), MethodOne: jest.fn(), MethodTwo: jest.fn(),},ClassName: class ClassName extends Component<ClassNameProps> { static PropOne: Component<ClassNameProps>|string = 'class-name.prop-one'; static PropTwo: Component<ClassNameProps>|string = 'class-name.prop.two'; static MethodOne = jest.fn(); static MethodTwo = jest.fn();},
P.S.: This component is part of a additional package. They are not on my project.