Skip to content

Instantly share code, notes, and snippets.

@sibelius
Created May 4, 2021 18:21
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sibelius/9cc90ebbff77c5e6112df5054b1cf603 to your computer and use it in GitHub Desktop.
Save sibelius/9cc90ebbff77c5e6112df5054b1cf603 to your computer and use it in GitHub Desktop.
react-google-login jest mock
jest.mock('react-google-login', () => {
const defaultMockSuccess = {
tokenId: 'tokenId',
};
const GoogleLogin = ({ onSuccess, buttonText }) => {
const handleClick = () => {
onSuccess(defaultMockSuccess);
};
return <button onClick={handleClick}>{buttonText}</button>;
};
return GoogleLogin;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment