0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-02-24 22:05:56 -05:00

test(connector-github): convert null to undefined in user info response (#945)

This commit is contained in:
Xiao Yijun 2022-05-25 11:32:04 +08:00 committed by GitHub
parent c325cf60f9
commit c3c2cc770d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -96,6 +96,19 @@ describe('getUserInfo', () => {
});
});
it('should convert `null` to `undefined` in SocialUserInfo', async () => {
nock(userInfoEndpoint).get('').reply(200, {
id: 1,
avatar_url: null,
name: null,
email: null,
});
const socialUserInfo = await githubMethods.getUserInfo({ accessToken: 'code' });
expect(socialUserInfo).toMatchObject({
id: '1',
});
});
it('throws SocialAccessTokenInvalid error if remote response code is 401', async () => {
nock(userInfoEndpoint).get('').reply(401);
await expect(githubMethods.getUserInfo({ accessToken: 'code' })).rejects.toMatchError(