@@ -32,6 +32,9 @@ const makeIdentityV2 = mocks.makeIdentityV2;
3232
3333let useCookie : boolean | undefined = undefined ;
3434
35+ const UID2Version = 'uid2' + '-sdk-' + UID2 . VERSION ;
36+ const uid2RefreshUrl = `https://prod.uidapi.com/v2/token/refresh?version=${ UID2Version } ` ;
37+
3538const testCookieAndLocalStorage = ( test : ( ) => void , only = false ) => {
3639 const describeFn = only ? describe . only : describe ;
3740 describeFn ( 'Using default: ' , ( ) => {
@@ -292,8 +295,7 @@ testCookieAndLocalStorage(() => {
292295
293296 test ( 'should initiate token refresh' , ( ) => {
294297 expect ( xhrMock . send ) . toHaveBeenCalledTimes ( 1 ) ;
295- const url = 'https://prod.uidapi.com/v2/token/refresh' ;
296- expect ( xhrMock . open ) . toHaveBeenLastCalledWith ( 'POST' , url , true ) ;
298+ expect ( xhrMock . open ) . toHaveBeenLastCalledWith ( 'POST' , uid2RefreshUrl , true ) ;
297299 expect ( xhrMock . send ) . toHaveBeenLastCalledWith ( identity . refresh_token ) ;
298300 xhrMock . onreadystatechange ( ) ;
299301 expect ( cryptoMock . subtle . importKey ) . toHaveBeenCalled ( ) ;
@@ -321,8 +323,7 @@ testCookieAndLocalStorage(() => {
321323 test ( 'should initiate token refresh' , ( ) => {
322324 const cryptoMock = new mocks . CryptoMock ( sdkWindow ) ;
323325 expect ( xhrMock . send ) . toHaveBeenCalledTimes ( 1 ) ;
324- const url = 'https://prod.uidapi.com/v2/token/refresh' ;
325- expect ( xhrMock . open ) . toHaveBeenLastCalledWith ( 'POST' , url , true ) ;
326+ expect ( xhrMock . open ) . toHaveBeenLastCalledWith ( 'POST' , uid2RefreshUrl , true ) ;
326327 expect ( xhrMock . send ) . toHaveBeenLastCalledWith ( identity . refresh_token ) ;
327328 xhrMock . onreadystatechange ( ) ;
328329 expect ( cryptoMock . subtle . importKey ) . toHaveBeenCalledTimes ( 0 ) ;
0 commit comments