Skip to content

Commit eb416d8

Browse files
committed
2 parents 5cdbbde + c8325ee commit eb416d8

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

test/common/security/SecurityManagerSpec.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { SecurityManager } from '../../../src/common/security/SecurityManager';
22
import { ServerInfo } from '../../../src/common/security/ServerInfo';
33
import { TokenServiceParameter } from '../../../src/common/security/TokenServiceParameter';
44
import { ServerType } from '../../../src/common/REST';
5+
import {FetchRequest} from '../../../src/common/util/FetchRequest';
56

67
describe('SecurityManager', () => {
78
var originalTimeout;
@@ -80,13 +81,20 @@ describe('SecurityManager', () => {
8081
});
8182

8283
it('loginOnline', () => {
84+
spyOn(window, 'open').and.callFake(()=>{});
8385
var callbackLocation = 'Online';
8486
var newTab = false;
8587
SecurityManager.loginOnline(callbackLocation, newTab);
88+
expect(window.open).toHaveBeenCalled();
8689
});
8790

8891
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';
9098
SecurityManager.loginiPortal(url, 'admin', 'admin');
9199
});
92100

test/karma.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ module.exports = function (config) {
5555
/***测试文件***/
5656
'./tool/**.js',
5757
'./resources/**.js',
58-
'./resources/img/**.png',
58+
// './resources/img/**.png',
5959
/***classic的源码***/
6060
/*由于除了classic其他都不依赖于8c,所以classic 的引入放在最后,以免被common覆盖*/
6161
{ pattern: '../src/classic/libs/SuperMap_Basic-8.1.1-17729.js', include: false },

0 commit comments

Comments
 (0)