@@ -2,6 +2,7 @@ import { SecurityManager } from '../../../src/common/security/SecurityManager';
2
2
import { ServerInfo } from '../../../src/common/security/ServerInfo' ;
3
3
import { TokenServiceParameter } from '../../../src/common/security/TokenServiceParameter' ;
4
4
import { ServerType } from '../../../src/common/REST' ;
5
+ import { FetchRequest } from '../../../src/common/util/FetchRequest' ;
5
6
6
7
describe ( 'SecurityManager' , ( ) => {
7
8
var originalTimeout ;
@@ -80,13 +81,20 @@ describe('SecurityManager', () => {
80
81
} ) ;
81
82
82
83
it ( 'loginOnline' , ( ) => {
84
+ spyOn ( window , 'open' ) . and . callFake ( ( ) => { } ) ;
83
85
var callbackLocation = 'Online' ;
84
86
var newTab = false ;
85
87
SecurityManager . loginOnline ( callbackLocation , newTab ) ;
88
+ expect ( window . open ) . toHaveBeenCalled ( ) ;
86
89
} ) ;
87
90
88
91
it ( 'loginiPortal' , ( ) => {
89
- var url = 'http://localhost:8092' ;
92
+ spyOn ( FetchRequest , 'post' ) . and . callFake ( ( testUrl , params , options ) => {
93
+ expect ( testUrl ) . toBe ( "http://fakeiportal/web/login" ) ;
94
+ expect ( params ) . not . toBeNull ( ) ;
95
+ return Promise . resolve ( new Response ( `{"succeed":true}` ) ) ;
96
+ } ) ;
97
+ var url = 'http://fakeiportal' ;
90
98
SecurityManager . loginiPortal ( url , 'admin' , 'admin' ) ;
91
99
} ) ;
92
100
0 commit comments