Skip to content

Commit

Permalink
Re-adding old code querystring parameter test.
Browse files Browse the repository at this point in the history
  • Loading branch information
filmaj committed Sep 13, 2021
1 parent 8566da4 commit 66066ee
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/oauth/src/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,26 @@ describe('OAuth', async () => {
assert.isTrue(sent);
});

it('should call the failure callback due to missing code query parameter on the URL', async () => {
const req = { url: 'http://example.com' };
let sent = false;
const res = { send: () => { sent = true; } };
const callbackOptions = {
success: async (installation, installOptions, req, res) => {
res.send('successful!');
assert.fail('should have failed');
},
failure: async (error, installOptions, req, res) => {
assert.equal(error.code, ErrorCode.MissingStateError)
res.send('failure');
},
}
const installer = new InstallProvider({ clientId, clientSecret, stateSecret, installationStore, logger: noopLogger });
await installer.handleCallback(req, res, callbackOptions);

assert.isTrue(sent);
});

it('should call the failure callback if an access_denied error query parameter was returned on the URL', async () => {
const req = { url: 'http://example.com?error=access_denied' };
let sent = false;
Expand Down

0 comments on commit 66066ee

Please sign in to comment.