File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -605,7 +605,7 @@ module.exports = function(User) {
605605 return cb ( err ) ;
606606 }
607607
608- user . accessTokens . create ( { ttl : ttl } , function ( err , accessToken ) {
608+ user . createAccessToken ( ttl , function ( err , accessToken ) {
609609 if ( err ) {
610610 return cb ( err ) ;
611611 }
Original file line number Diff line number Diff line change @@ -1884,6 +1884,19 @@ describe('User', function() {
18841884 } ) ;
18851885 } ) ;
18861886
1887+ it ( 'calls createAccessToken() to create the token' , function ( done ) {
1888+ User . prototype . createAccessToken = function ( ttl , cb ) {
1889+ cb ( null , new AccessToken ( { id : 'custom-token' } ) ) ;
1890+ } ;
1891+
1892+ User . resetPassword ( { email : options . email } , function ( ) { } ) ;
1893+
1894+ User . once ( 'resetPasswordRequest' , function ( info ) {
1895+ expect ( info . accessToken . id ) . to . equal ( 'custom-token' ) ;
1896+ done ( ) ;
1897+ } ) ;
1898+ } ) ;
1899+
18871900 it ( 'Password reset over REST rejected without email address' , function ( done ) {
18881901 request ( app )
18891902 . post ( '/test-users/reset' )
You can’t perform that action at this time.
0 commit comments