Skip to content

Commit

Permalink
Fixed authenticator invalidate test.
Browse files Browse the repository at this point in the history
  • Loading branch information
candunaj committed Dec 2, 2021
1 parent 5d0f0f5 commit a253371
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -333,17 +333,23 @@ describe('OAuth2PasswordGrantAuthenticator', () => {

describe('when a refresh token is set', function() {
it('sends an AJAX request to invalidate the refresh token', async function() {
let revokeRequests = [];
server.post('/revoke', (request) => {
let { requestBody } = request;
let body = parsePostData(requestBody);

expect(body).to.eql({
'token_type_hint': 'refresh_token',
'token': 'refresh token!'
});
revokeRequests.push(body);
});

await authenticator.invalidate({ 'access_token': 'access token!', 'refresh_token': 'refresh token!' });
expect(revokeRequests.length).to.eq(2);
expect(revokeRequests.find(body => body.token_type_hint === 'refresh_token')).to.eql({
'token_type_hint': 'refresh_token',
'token': 'refresh token!'
});
expect(revokeRequests.find(body => body.token_type_hint === 'access_token')).to.eql({
'token_type_hint': 'access_token',
'token': 'access token!'
});
});
});
});
Expand Down

0 comments on commit a253371

Please sign in to comment.