Skip to content

Commit

Permalink
[Tests] prop-types: add test
Browse files Browse the repository at this point in the history
Closes #2747
  • Loading branch information
jzabala authored and ljharb committed Aug 14, 2020
1 parent 6612375 commit 2588c4d
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions tests/lib/rules/prop-types.js
Expand Up @@ -2898,6 +2898,73 @@ ruleTester.run('prop-types', rule, {
) => (<div />)
`,
parser: parsers['@TYPESCRIPT_ESLINT']
},
{
code: `
interface Props extends V2SocialLoginProps {
autoLoad: boolean;
}
export const DKFacebookButton = ({
autoLoad,
authAction,
errorHandler,
redirectUrl,
isSignup,
}: Props): JSX.Element | null => {
if (!APP_ID) {
rollbar.error('Missing Facebook OAuth App Id');
return null;
}
const fbButtonText = isSignup ? 'Sign up with Facebook' : 'Log in with Facebook';
const responseCallback = async ({
accessToken,
email = '',
name = '',
}: ReactFacebookLoginInfo) => {
const [firstName, lastName] = name.split(' ');
const requestData: DK.SocialLogin = {
accessToken,
email,
firstName,
lastName,
intercomUserId: intercomService.getVisitorId(),
};
try {
await authAction(requestData, redirectUrl);
} catch (err) {
errorHandler(err.message);
}
};
const FacebookIcon = () => (
<img
style={{ marginRight: '8px' }}
src={facebookIcon}
alt='Facebook Login'
/>
);
return (
<FacebookLogin
cssClass='ant-btn dk-button dk-facebook-button dk-button--secondary ant-btn-primary ant-btn-lg'
autoLoad={autoLoad}
textButton={fbButtonText}
size='small'
icon={<FacebookIcon />}
appId={APP_ID}
fields='name,email'
callback={responseCallback}
data-testId='dk-facebook-button'
/>
);
};
`,
parser: parsers['@TYPESCRIPT_ESLINT']
}
])
),
Expand Down

0 comments on commit 2588c4d

Please sign in to comment.