Skip to content

Commit 0d4e5f3

Browse files
added extra test for coverage
1 parent 8ce21a4 commit 0d4e5f3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/compliance/refresh-token-grant-type_test.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,26 @@ describe('RefreshTokenGrantType Compliance', function () {
186186
});
187187
});
188188

189+
it('Should throw error if a scope is requested without a previous scope', async function () {
190+
const request = createLoginRequest();
191+
const response = new Response({});
192+
193+
delete request.body.scope;
194+
195+
const credentials = await auth.token(request, response, {});
196+
197+
const refreshRequest = createRefreshRequest(credentials.refreshToken);
198+
const refreshResponse = new Response({});
199+
200+
refreshRequest.scope = 'read write';
201+
202+
await auth.token(refreshRequest, refreshResponse, {})
203+
.then(should.fail)
204+
.catch(err => {
205+
err.name.should.equal('invalid_scope');
206+
});
207+
});
208+
189209
it('Should create refresh token with smaller scope', async function () {
190210
const request = createLoginRequest();
191211
const response = new Response({});

0 commit comments

Comments
 (0)