what is the right way to test component like this.
import { CreateLanguage } from './Create';
export const CreateLanguageContainer = withRouter(({ history }) => {
return (
<AddLanguageComponent>
{(addLanguage, { loading }) => {
return (
<CreateLanguage
loading={loading}
onSubmit={(values: AddLanguageVariables) => {
addLanguage({ variables: values }).then(() => {
history.push('/dashboard/languages');
});
}}
/>
);
}}
</AddLanguageComponent>
);
});
AddLanguageComponent is render props which is being generated by graphql-code-generator to have type definition for Query and Mutation component.
I want to test my mutation. But I am not sure where to test it. I can not test my mutation here because I don't have any way to execute onSumit methods.
This component is passing mutation function to the child component. I can not test in the child component because it is passed as props. so my child component won't have to call mutation
I am confused now. Should I rewrite my component?
Aucun commentaire:
Enregistrer un commentaire