@@ -885,24 +885,6 @@ describe('_closeAllSkillDropdowns', () => {
885885// Session TTL Management
886886// ===========================================================================
887887
888- describe ( 'isAccountsUrl' , ( ) => {
889- test ( 'returns true for /accounts/ paths' , ( ) => {
890- expect ( isAccountsUrl ( 'https://anypoint.mulesoft.com/accounts/login' ) ) . toBe ( true ) ;
891- expect ( isAccountsUrl ( 'https://anypoint.mulesoft.com/accounts/api/me' ) ) . toBe ( true ) ;
892- expect ( isAccountsUrl ( 'https://anypoint.mulesoft.com/accounts/oauth2/introspect' ) ) . toBe ( true ) ;
893- } ) ;
894-
895- test ( 'returns false for non-accounts paths' , ( ) => {
896- expect ( isAccountsUrl ( 'https://anypoint.mulesoft.com/apimanager/api/v1/organizations/123/apis' ) ) . toBe ( false ) ;
897- expect ( isAccountsUrl ( 'https://anypoint.mulesoft.com/exchange/api/v2/assets' ) ) . toBe ( false ) ;
898- } ) ;
899-
900- test ( 'handles malformed URLs gracefully' , ( ) => {
901- expect ( isAccountsUrl ( 'not-a-url-with-/accounts/' ) ) . toBe ( true ) ;
902- expect ( isAccountsUrl ( 'not-a-url' ) ) . toBe ( false ) ;
903- } ) ;
904- } ) ;
905-
906888describe ( 'setTokenExpiration' , ( ) => {
907889 beforeEach ( ( ) => sessionStorage . clear ( ) ) ;
908890
@@ -912,24 +894,6 @@ describe('setTokenExpiration', () => {
912894 } ) ;
913895} ) ;
914896
915- describe ( 'extendTokenExpiration' , ( ) => {
916- beforeEach ( ( ) => sessionStorage . clear ( ) ) ;
917-
918- test ( 'does nothing when no token exists' , ( ) => {
919- extendTokenExpiration ( ) ;
920- expect ( sessionStorage . getItem ( 'anypoint_token_expires_at' ) ) . toBeNull ( ) ;
921- } ) ;
922-
923- test ( 'sets expiration to ~1h from now when token exists' , ( ) => {
924- sessionStorage . setItem ( 'anypoint_token' , 'test-token' ) ;
925- var before = Date . now ( ) ;
926- extendTokenExpiration ( ) ;
927- var stored = parseInt ( sessionStorage . getItem ( 'anypoint_token_expires_at' ) , 10 ) ;
928- expect ( stored ) . toBeGreaterThanOrEqual ( before + 3600000 - 100 ) ;
929- expect ( stored ) . toBeLessThanOrEqual ( Date . now ( ) + 3600000 + 100 ) ;
930- } ) ;
931- } ) ;
932-
933897describe ( 'markTokenExpired' , ( ) => {
934898 beforeEach ( ( ) => {
935899 sessionStorage . clear ( ) ;
@@ -975,26 +939,19 @@ describe('handleProxyResponse', () => {
975939 } ) ;
976940
977941 test ( 'marks token expired on 401' , ( ) => {
978- handleProxyResponse ( { status : 401 } , 'https://anypoint.mulesoft.com/apimanager/api/v1/orgs' ) ;
942+ handleProxyResponse ( { status : 401 } ) ;
979943 expect ( sessionStorage . getItem ( 'anypoint_token_expires_at' ) ) . toBe ( '0' ) ;
980944 } ) ;
981945
982- test ( 'extends TTL on 2xx non-accounts response' , ( ) => {
983- var before = Date . now ( ) ;
984- handleProxyResponse ( { status : 200 } , 'https://anypoint.mulesoft.com/apimanager/api/v1/orgs' ) ;
985- var stored = parseInt ( sessionStorage . getItem ( 'anypoint_token_expires_at' ) , 10 ) ;
986- expect ( stored ) . toBeGreaterThanOrEqual ( before + 3600000 - 100 ) ;
987- } ) ;
988-
989- test ( 'does NOT extend TTL on 2xx accounts response' , ( ) => {
946+ test ( 'does nothing on non-401 responses' , ( ) => {
990947 var original = sessionStorage . getItem ( 'anypoint_token_expires_at' ) ;
991- handleProxyResponse ( { status : 200 } , 'https://anypoint.mulesoft.com/accounts/api/me' ) ;
948+ handleProxyResponse ( { status : 200 } ) ;
992949 expect ( sessionStorage . getItem ( 'anypoint_token_expires_at' ) ) . toBe ( original ) ;
993950 } ) ;
994951
995- test ( 'does nothing on non-401 error responses' , ( ) => {
952+ test ( 'does nothing on server error responses' , ( ) => {
996953 var original = sessionStorage . getItem ( 'anypoint_token_expires_at' ) ;
997- handleProxyResponse ( { status : 500 } , 'https://anypoint.mulesoft.com/apimanager/api/v1/orgs' ) ;
954+ handleProxyResponse ( { status : 500 } ) ;
998955 expect ( sessionStorage . getItem ( 'anypoint_token_expires_at' ) ) . toBe ( original ) ;
999956 } ) ;
1000957} ) ;
0 commit comments