@@ -97,7 +97,30 @@ describe("refresh_token grant", () => {
9797 expectTokenResponse ( tokenResponse ) ;
9898 expect ( tokenResponse . body . scope ) . toBe ( "scope-1" ) ;
9999 expect ( tokenResponse . body . refresh_token ) . toMatch ( REGEX_ACCESS_TOKEN ) ;
100- expect ( extraJwtFieldsSpy ) . toHaveBeenCalledWith ( request , client , user ) ;
100+ expect ( extraJwtFieldsSpy ) . toHaveBeenCalledWith ( request , client , user , undefined ) ;
101+ } ) ;
102+
103+ it ( "provides originatingAuthCodeId as argument to extraJwtFields" , async ( ) => {
104+ accessToken . originatingAuthCodeId = "my-super-secret-auth-code" ;
105+
106+ // arrange
107+ const bearerResponse = await grant . makeBearerTokenResponse ( client , accessToken ) ;
108+ request = new OAuthRequest ( {
109+ body : {
110+ grant_type : "refresh_token" ,
111+ client_id : client . id ,
112+ client_secret : client . secret ,
113+ refresh_token : bearerResponse . body . refresh_token ,
114+ scope : "scope-1" ,
115+ } ,
116+ } ) ;
117+ const accessTokenTTL = new DateInterval ( "1h" ) ;
118+
119+ const extraJwtFieldsSpy = vi . spyOn ( grant as any , "extraJwtFields" ) ;
120+
121+ await grant . respondToAccessTokenRequest ( request , accessTokenTTL ) ;
122+
123+ expect ( extraJwtFieldsSpy ) . toHaveBeenCalledWith ( request , client , user , "my-super-secret-auth-code" ) ;
101124 } ) ;
102125
103126 it ( "populates originatingAuthCodeId property in OAuthToken object" , async ( ) => {
0 commit comments