Skip to content

Commit fd8f367

Browse files
committed
tests: update string asserter tests
1 parent aa88382 commit fd8f367

2 files changed

Lines changed: 19 additions & 9 deletions

File tree

test/integration/grant-types/authorization-code-grant-type_test.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -415,15 +415,25 @@ describe('AuthorizationCodeGrantType integration', function() {
415415
revokeAuthorizationCode: () => should.fail(),
416416
saveToken: () => should.fail()
417417
});
418-
const grantType = new AuthorizationCodeGrantType({ accessTokenLifetime: 123, model: model });
419-
const request = new Request({ body: { code: '12345' }, headers: {}, method: {}, query: {} });
420418

421-
try {
422-
await grantType.getAuthorizationCode(request, client);
423-
should.fail();
424-
} catch (e) {
425-
e.should.be.an.instanceOf(InvalidGrantError);
426-
e.message.should.equal('Invalid grant: authorization code has expired');
419+
const variations = [
420+
[123, '12345'],
421+
[123, 12345],
422+
['123', '12345'],
423+
['123', 12345],
424+
];
425+
426+
for (const [accessTokenLifetime, code] of variations) {
427+
const grantType = new AuthorizationCodeGrantType({ accessTokenLifetime, model: model });
428+
const request = new Request({ body: { code }, headers: {}, method: {}, query: {} });
429+
430+
try {
431+
await grantType.getAuthorizationCode(request, client);
432+
should.fail();
433+
} catch (e) {
434+
e.should.be.an.instanceOf(InvalidGrantError);
435+
e.message.should.equal('Invalid grant: authorization code has expired');
436+
}
427437
}
428438
});
429439

test/integration/grant-types/refresh-token-grant-type_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ describe('RefreshTokenGrantType integration', function() {
218218
saveToken: () => should.fail()
219219
});
220220
const grantType = new RefreshTokenGrantType({ accessTokenLifetime: 120, model });
221-
const values = ['toke😇n', () => {}, [], Symbol('test')];
221+
const values = ['toke😇n', () => {}, [], Symbol('test'), true, {}];
222222

223223
for (const value of values) {
224224
const request = new Request({ body: { refresh_token: value }, headers: {}, method: {}, query: {} });

0 commit comments

Comments
 (0)