Skip to content

Commit a1bba81

Browse files
committed
fix CI 优化测试 review by zhurch
1 parent 33b0eb8 commit a1bba81

File tree

1 file changed

+51
-24
lines changed

1 file changed

+51
-24
lines changed

test/common/iServer/SurfaceAnalystServiceSpec.js

Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,37 @@
1-
import {SurfaceAnalystService} from '../../../src/common/iServer/SurfaceAnalystService';
2-
import {DatasetSurfaceAnalystParameters} from '../../../src/common/iServer/DatasetSurfaceAnalystParameters';
3-
import {GeometrySurfaceAnalystParameters} from '../../../src/common/iServer/GeometrySurfaceAnalystParameters';
4-
import {SurfaceAnalystParametersSetting} from '../../../src/common/iServer/SurfaceAnalystParametersSetting';
5-
import {DataReturnOption} from '../../../src/common/iServer/DataReturnOption';
6-
import {Util} from '../../../src/common/commontypes/Util';
7-
import {Point} from '../../../src/common/commontypes/geometry/Point';
8-
import {SmoothMethod} from '../../../src/common/REST';
9-
import {SurfaceAnalystMethod} from '../../../src/common/REST';
10-
import {FetchRequest} from '../../../src/common/util/FetchRequest';
1+
import {
2+
SurfaceAnalystService
3+
} from '../../../src/common/iServer/SurfaceAnalystService';
4+
import {
5+
DatasetSurfaceAnalystParameters
6+
} from '../../../src/common/iServer/DatasetSurfaceAnalystParameters';
7+
import {
8+
GeometrySurfaceAnalystParameters
9+
} from '../../../src/common/iServer/GeometrySurfaceAnalystParameters';
10+
import {
11+
SurfaceAnalystParametersSetting
12+
} from '../../../src/common/iServer/SurfaceAnalystParametersSetting';
13+
import {
14+
DataReturnOption
15+
} from '../../../src/common/iServer/DataReturnOption';
16+
import {
17+
Util
18+
} from '../../../src/common/commontypes/Util';
19+
import {
20+
Point
21+
} from '../../../src/common/commontypes/geometry/Point';
22+
import {
23+
SmoothMethod
24+
} from '../../../src/common/REST';
25+
import {
26+
SurfaceAnalystMethod
27+
} from '../../../src/common/REST';
28+
import {
29+
FetchRequest
30+
} from '../../../src/common/util/FetchRequest';
1131

1232
var spatialAnalystURL = "http://supermap:8090/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst";
13-
var surfaceAnalystEventArgsSystem = null, serviceFailedEventArgsSystem = null;
33+
var surfaceAnalystEventArgsSystem = null,
34+
serviceFailedEventArgsSystem = null;
1435
var surfaceAnalystCompleted = (surfaceAnalystEventArgs) => {
1536
surfaceAnalystEventArgsSystem = surfaceAnalystEventArgs;
1637
};
@@ -55,16 +76,18 @@ describe('SurfaceAnalystService', () => {
5576
resolution: 3000,
5677
zValueFieldName: "AVG_TMP",
5778
surfaceAnalystMethod: SurfaceAnalystMethod.ISOLINE,
58-
resultSetting: new DataReturnOption({expectCount: 1})
79+
resultSetting: new DataReturnOption({
80+
expectCount: 1
81+
})
5982
});
6083
var surfaceAnalystService = initSurfaceService();
6184
expect(surfaceAnalystService).not.toBeNull();
6285
expect(surfaceAnalystService.url).toEqual(spatialAnalystURL);
6386
spyOn(FetchRequest, 'commit').and.callFake((method, testUrl, params, options) => {
6487
expect(method).toBe('POST');
6588
expect(testUrl).toBe(spatialAnalystURL + "/datasets/SamplesP@Interpolation/isoline.json?returnContent=true");
66-
//var expectParams = "{'resolution':3000,'extractParameter':{'datumValue':0,'interval':2,'resampleTolerance':0,'smoothMethod':\"BSPLINE\",'smoothness':3},'resultSetting':{'expectCount':1,'dataset':null,'dataReturnMode':\"RECORDSET_ONLY\",'deleteExistResultDataset':true},'zValueFieldName':\"AVG_TMP\",'filterQueryParameter':{'attributeFilter':null,'name':null,'joinItems':null,'linkItems':null,'ids':null,'orderBy':null,'groupBy':null,'fields':null}}";
67-
//expect(params).toBe(expectParams);
89+
var expectParams = "{'resolution':3000,'extractParameter':{'datumValue':0,'interval':2,'resampleTolerance':0,'smoothMethod':\"BSPLINE\",'smoothness':3},'resultSetting':{'expectCount':1,'dataset':null,'dataReturnMode':\"RECORDSET_ONLY\",'deleteExistResultDataset':true},'zValueFieldName':\"AVG_TMP\",'filterQueryParameter':{'attributeFilter':null,'name':null,'joinItems':null,'linkItems':null,'ids':null,'orderBy':null,'groupBy':null,'fields':null}}";
90+
expect(params).toBe(expectParams);
6891
expect(options).not.toBeNull();
6992
return Promise.resolve(new Response(surfaceAnalystEscapedJson));
7093
});
@@ -117,13 +140,15 @@ describe('SurfaceAnalystService', () => {
117140
resolution: 3000,
118141
zValueFieldName: "AVG_WTR",
119142
surfaceAnalystMethod: SurfaceAnalystMethod.ISOREGION,
120-
resultSetting: new DataReturnOption({expectCount: 1})
143+
resultSetting: new DataReturnOption({
144+
expectCount: 1
145+
})
121146
});
122147
spyOn(FetchRequest, 'commit').and.callFake((method, testUrl, params, options) => {
123148
expect(method).toBe('POST');
124149
expect(testUrl).toBe(spatialAnalystURL + "/datasets/SamplesP@Interpolation/isoregion.json?returnContent=true");
125-
//var expectParams = "{'resolution':3000,'extractParameter':{'datumValue':70,'interval':100,'resampleTolerance':0.7,'smoothMethod':\"BSPLINE\",'smoothness':3},'resultSetting':{'expectCount':1,'dataset':null,'dataReturnMode':\"RECORDSET_ONLY\",'deleteExistResultDataset':true},'zValueFieldName':\"AVG_WTR\",'filterQueryParameter':{'attributeFilter':null,'name':null,'joinItems':null,'linkItems':null,'ids':null,'orderBy':null,'groupBy':null,'fields':null}}";
126-
//expect(params).toBe(expectParams);
150+
var expectParams = "{'resolution':3000,'extractParameter':{'datumValue':70,'interval':100,'resampleTolerance':0.7,'smoothMethod':\"BSPLINE\",'smoothness':3},'resultSetting':{'expectCount':1,'dataset':null,'dataReturnMode':\"RECORDSET_ONLY\",'deleteExistResultDataset':true},'zValueFieldName':\"AVG_WTR\",'filterQueryParameter':{'attributeFilter':null,'name':null,'joinItems':null,'linkItems':null,'ids':null,'orderBy':null,'groupBy':null,'fields':null}}";
151+
expect(params).toBe(expectParams);
127152
expect(options).not.toBeNull();
128153
return Promise.resolve(new Response(surfaceAnalysis_Dataset_ISOREGION));
129154
});
@@ -172,8 +197,10 @@ describe('SurfaceAnalystService', () => {
172197
spyOn(FetchRequest, 'commit').and.callFake((method, testUrl, params, options) => {
173198
expect(method).toBe('POST');
174199
expect(testUrl).toBe(spatialAnalystURL + "/geometry/isoline.json?returnContent=true");
175-
var expectParams = "{'resolution':3000,'extractParameter':{'datumValue':-3,'interval':0.5,'resampleTolerance':0.7,'smoothMethod':\"BSPLINE\",'smoothness':3},'resultSetting':{'expectCount':1,'dataset':null,'dataReturnMode':\"RECORDSET_ONLY\",'deleteExistResultDataset':true},'surfaceAnalystMethod':\"ISOLINE\",'points':[{'id':\"SuperMap.Geometry_1\",'bounds':null,'SRID':null,'x':-4000,'y':2000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_2\",'bounds':null,'SRID':null,'x':-4500,'y':2000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_3\",'bounds':null,'SRID':null,'x':-3000,'y':3000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_4\",'bounds':null,'SRID':null,'x':-3000,'y':2000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_5\",'bounds':null,'SRID':null,'x':-2500,'y':2500,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_6\",'bounds':null,'SRID':null,'x':-2000,'y':2000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_7\",'bounds':null,'SRID':null,'x':-2000,'y':3000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_8\",'bounds':null,'SRID':null,'x':-2000,'y':2000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_9\",'bounds':null,'SRID':null,'x':2000,'y':4000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_10\",'bounds':null,'SRID':null,'x':0,'y':0,'tag':null,'type':\"Point\"}],'zValues':[-3,-2,0,-1,-3,0,1,0,1,1]}";
176-
expect(params).toBe(expectParams);
200+
var paramsObj = JSON.parse(params.replace(/'/g, "\""));
201+
expect(paramsObj.extractParameter.resampleTolerance).toBe(0.7);
202+
expect(paramsObj.resolution).toBe(3000);
203+
expect(paramsObj.surfaceAnalystMethod).toBe(SurfaceAnalystMethod.ISOLINE);
177204
expect(options).not.toBeNull();
178205
return Promise.resolve(new Response(surfaceAnalysis_Geometry_ISOLINE));
179206
});
@@ -225,8 +252,10 @@ describe('SurfaceAnalystService', () => {
225252
spyOn(FetchRequest, 'commit').and.callFake((method, testUrl, params, options) => {
226253
expect(method).toBe('POST');
227254
expect(testUrl).toBe(spatialAnalystURL + "/geometry/isoregion.json?returnContent=true");
228-
var expectParams = "{'resolution':3000,'extractParameter':{'datumValue':-3,'interval':0.5,'resampleTolerance':0.7,'smoothMethod':\"BSPLINE\",'smoothness':3},'resultSetting':{'expectCount':1,'dataset':null,'dataReturnMode':\"RECORDSET_ONLY\",'deleteExistResultDataset':true},'surfaceAnalystMethod':\"ISOREGION\",'points':[{'id':\"SuperMap.Geometry_1\",'bounds':null,'SRID':null,'x':-4000,'y':2000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_2\",'bounds':null,'SRID':null,'x':-4500,'y':2000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_3\",'bounds':null,'SRID':null,'x':-3000,'y':3000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_4\",'bounds':null,'SRID':null,'x':-3000,'y':2000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_5\",'bounds':null,'SRID':null,'x':-2500,'y':2500,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_6\",'bounds':null,'SRID':null,'x':-2000,'y':2000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_7\",'bounds':null,'SRID':null,'x':-2000,'y':3000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_8\",'bounds':null,'SRID':null,'x':-2000,'y':2000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_9\",'bounds':null,'SRID':null,'x':2000,'y':4000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_10\",'bounds':null,'SRID':null,'x':0,'y':0,'tag':null,'type':\"Point\"}],'zValues':[-3,0,10,20,13,8,5,20,10,15]}";
229-
expect(params).toBe(expectParams);
255+
var paramsObj = JSON.parse(params.replace(/'/g, "\""));
256+
expect(paramsObj.extractParameter.resampleTolerance).toBe(0.7);
257+
expect(paramsObj.resolution).toBe(3000);
258+
expect(paramsObj.surfaceAnalystMethod).toBe(SurfaceAnalystMethod.ISOREGION);
230259
expect(options).not.toBeNull();
231260
return Promise.resolve(new Response(surfaceAnalysis_Geometry_ISOREGION));
232261
});
@@ -278,6 +307,4 @@ describe('SurfaceAnalystService', () => {
278307
done();
279308
}, 1000);
280309
})
281-
});
282-
283-
310+
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy