Skip to content

Commit bfc4e8f

Browse files
Added tests.
1 parent f6db51a commit bfc4e8f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test/integration/grant-types/client-credentials-grant-type_test.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,21 @@ describe('ClientCredentialsGrantType integration', function() {
9393
it('should return a token', function() {
9494
const token = {};
9595
const model = {
96-
getUserFromClient: function() { return {}; },
97-
saveToken: function() { return token; },
96+
getUserFromClient: async function(client) {
97+
client.foo.should.equal('bar');
98+
return { id: '123'};
99+
},
100+
saveToken: async function(_token, client, user) {
101+
client.foo.should.equal('bar');
102+
user.id.should.equal('123');
103+
return token;
104+
},
98105
validateScope: function() { return 'foo'; }
99106
};
100107
const grantType = new ClientCredentialsGrantType({ accessTokenLifetime: 120, model: model });
101108
const request = new Request({ body: {}, headers: {}, method: {}, query: {} });
102109

103-
return grantType.handle(request, {})
110+
return grantType.handle(request, { foo: 'bar' })
104111
.then(function(data) {
105112
data.should.equal(token);
106113
})

0 commit comments

Comments
 (0)