Skip to content

Instantly share code, notes, and snippets.

@guliash
Created April 20, 2021 13:03
Show Gist options
  • Save guliash/e3490b41756ae32a8a04ce2cef25cbc6 to your computer and use it in GitHub Desktop.
Save guliash/e3490b41756ae32a8a04ce2cef25cbc6 to your computer and use it in GitHub Desktop.
Nock test fail
it('Profile endpoint 500. 500', async () => {
after(() => {
nock.cleanAll();
});
const agent = request.agent(app);
nock('https://oauth2.googleapis.com')
.post('/token')
.reply(200, { access_token: 'access_token' })
nock('https://openidconnect.googleapis.com')
.get('/v1/userinfo')
.matchHeader('Authorization', 'Bearer access_token')
.reply(500);
const response = await agent.post('/api/user/login/google')
.send({ authCode: 'code' });
assert.strictEqual(response.status, 500);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment