@@ -177,11 +177,12 @@ describe('PasswordGrantType integration', function() {
177177 getUser : ( ) => should . fail ( ) ,
178178 saveToken : ( ) => should . fail ( )
179179 } ;
180+ const client = { id : 'foobar' } ;
180181 const grantType = new PasswordGrantType ( { accessTokenLifetime : 123 , model } ) ;
181182 const request = new Request ( { body : { } , headers : { } , method : { } , query : { } } ) ;
182183
183184 try {
184- await grantType . getUser ( request ) ;
185+ await grantType . getUser ( request , client ) ;
185186
186187 should . fail ( ) ;
187188 } catch ( e ) {
@@ -195,11 +196,12 @@ describe('PasswordGrantType integration', function() {
195196 getUser : ( ) => should . fail ( ) ,
196197 saveToken : ( ) => should . fail ( )
197198 } ;
199+ const client = { id : 'foobar' } ;
198200 const grantType = new PasswordGrantType ( { accessTokenLifetime : 123 , model } ) ;
199201 const request = new Request ( { body : { username : 'foo' } , headers : { } , method : { } , query : { } } ) ;
200202
201203 try {
202- await grantType . getUser ( request ) ;
204+ await grantType . getUser ( request , client ) ;
203205
204206 should . fail ( ) ;
205207 } catch ( e ) {
@@ -213,11 +215,12 @@ describe('PasswordGrantType integration', function() {
213215 getUser : ( ) => should . fail ( ) ,
214216 saveToken : ( ) => should . fail ( )
215217 } ;
218+ const client = { id : 'foobar' } ;
216219 const grantType = new PasswordGrantType ( { accessTokenLifetime : 123 , model } ) ;
217220 const request = new Request ( { body : { username : '\r\n' , password : 'foobar' } , headers : { } , method : { } , query : { } } ) ;
218221
219222 try {
220- await grantType . getUser ( request ) ;
223+ await grantType . getUser ( request , client ) ;
221224
222225 should . fail ( ) ;
223226 } catch ( e ) {
@@ -231,11 +234,12 @@ describe('PasswordGrantType integration', function() {
231234 getUser : ( ) => should . fail ( ) ,
232235 saveToken : ( ) => should . fail ( )
233236 } ;
237+ const client = { id : 'foobar' } ;
234238 const grantType = new PasswordGrantType ( { accessTokenLifetime : 123 , model } ) ;
235239 const request = new Request ( { body : { username : 'foobar' , password : '\r\n' } , headers : { } , method : { } , query : { } } ) ;
236240
237241 try {
238- await grantType . getUser ( request ) ;
242+ await grantType . getUser ( request , client ) ;
239243
240244 should . fail ( ) ;
241245 } catch ( e ) {
@@ -249,11 +253,12 @@ describe('PasswordGrantType integration', function() {
249253 getUser : async ( ) => undefined ,
250254 saveToken : ( ) => should . fail ( )
251255 } ;
256+ const client = { id : 'foobar' } ;
252257 const grantType = new PasswordGrantType ( { accessTokenLifetime : 123 , model } ) ;
253258 const request = new Request ( { body : { username : 'foo' , password : 'bar' } , headers : { } , method : { } , query : { } } ) ;
254259
255260 try {
256- await grantType . getUser ( request ) ;
261+ await grantType . getUser ( request , client ) ;
257262 should . fail ( ) ;
258263 } catch ( e ) {
259264 e . should . be . an . instanceOf ( InvalidGrantError ) ;
@@ -263,6 +268,7 @@ describe('PasswordGrantType integration', function() {
263268
264269 it ( 'should return a user' , async function ( ) {
265270 const user = { email :
'[email protected] ' } ; 271+ const client = { id : 'foobar' } ;
266272 const model = {
267273 getUser : function ( username , password ) {
268274 username . should . equal ( 'foo' ) ;
@@ -274,32 +280,34 @@ describe('PasswordGrantType integration', function() {
274280 const grantType = new PasswordGrantType ( { accessTokenLifetime : 123 , model } ) ;
275281 const request = new Request ( { body : { username : 'foo' , password : 'bar' } , headers : { } , method : { } , query : { } } ) ;
276282
277- const data = await grantType . getUser ( request ) ;
283+ const data = await grantType . getUser ( request , client ) ;
278284 data . should . equal ( user ) ;
279285 } ) ;
280286
281287 it ( 'should support promises' , function ( ) {
282288 const user = { email :
'[email protected] ' } ; 289+ const client = { id : 'foobar' } ;
283290 const model = {
284291 getUser : async function ( ) { return user ; } ,
285292 saveToken : ( ) => should . fail ( )
286293 } ;
287294 const grantType = new PasswordGrantType ( { accessTokenLifetime : 123 , model } ) ;
288295 const request = new Request ( { body : { username : 'foo' , password : 'bar' } , headers : { } , method : { } , query : { } } ) ;
289296
290- grantType . getUser ( request ) . should . be . an . instanceOf ( Promise ) ;
297+ grantType . getUser ( request , client ) . should . be . an . instanceOf ( Promise ) ;
291298 } ) ;
292299
293300 it ( 'should support non-promises' , function ( ) {
294301 const user = { email :
'[email protected] ' } ; 302+ const client = { id : 'foobar' } ;
295303 const model = {
296304 getUser : function ( ) { return user ; } ,
297305 saveToken : ( ) => should . fail ( )
298306 } ;
299307 const grantType = new PasswordGrantType ( { accessTokenLifetime : 123 , model } ) ;
300308 const request = new Request ( { body : { username : 'foo' , password : 'bar' } , headers : { } , method : { } , query : { } } ) ;
301309
302- grantType . getUser ( request ) . should . be . an . instanceOf ( Promise ) ;
310+ grantType . getUser ( request , client ) . should . be . an . instanceOf ( Promise ) ;
303311 } ) ;
304312 } ) ;
305313
0 commit comments