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:
parent
c325cf60f9
commit
c3c2cc770d
1 changed files with 13 additions and 0 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Reference in a new issue