Skip to content

Commit 0ddb99f

Browse files
fix UT
1 parent 1cb49ee commit 0ddb99f

File tree

2 files changed

+31
-14
lines changed

2 files changed

+31
-14
lines changed

test/common/iServer/EditFeaturesServiceSpec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ describe('testEditFeaturesService', function () {
227227
expect(noParamsSuccessEventArgsSystem).toBeNull();
228228
expect(noParamsFailedEventArgsSystem).not.toBeNull();
229229
expect(noParamsFailedEventArgsSystem.type).toBe('processFailed');
230-
expect(noParamsFailedEventArgsSystem.object.options.data).toBeUndefined();
231230
expect(noParamsFailedEventArgsSystem.object.options.method).toBe('POST');
232231
expect(noParamsFailedEventArgsSystem.error).not.toBeNull();
233232
expect(noParamsFailedEventArgsSystem.error.code).toEqual(400);

test/common/iServer/FindTSPPathsServiceSpec.js

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,36 @@ describe('testFindTSPPathsService_processAsync',function(){
6868
expect(analystResult[0].edgeFeatures).not.toBeNull();
6969
expect(analystResult[0].edgeFeatures.type).toEqual("FeatureCollection");
7070
expect(analystResult[0].edgeFeatures.features).not.toBeNull();
71-
expect(analystResult[0].edgeFeatures.features[0].type).toEqual("Feature");
72-
expect(analystResult[0].edgeFeatures.features[0].geometry).not.toBeNull();
71+
expect(analystResult[0].edgeFeatures.features.length).toBeGreaterThan(0);
72+
for(var i = 0;i<analystResult[0].edgeFeatures.features.length;i++){
73+
expect(analystResult[0].edgeFeatures.features[i].type).toBe("Feature");
74+
expect(analystResult[0].edgeFeatures.features[i].geometry).not.toBeNull();
75+
expect(analystResult[0].edgeFeatures.features[i].id).not.toBeNull();
76+
expect(analystResult[0].edgeFeatures.features[i].properties).not.toBeNull();
77+
}
78+
expect(analystResult[0].edgeFeatures.features[0].id).toEqual(2886);
79+
expect(analystResult[0].edgeFeatures.features[0].geometry.type).toBe("LineString");
80+
expect(analystResult[0].edgeFeatures.features[0].geometry.coordinates.length).toBeGreaterThan(0);
7381
expect(analystResult[0].edgeFeatures.features[0].properties.ID).toEqual(2886);
7482
expect(analystResult[0].nodeFeatures).not.toBeNull();
83+
expect(analystResult[0].nodeFeatures.type).toEqual("FeatureCollection");
84+
expect(analystResult[0].nodeFeatures.features).not.toBeNull();
85+
expect(analystResult[0].nodeFeatures.features.length).toBeGreaterThan(0);
86+
for(var j = 0;j<analystResult[0].edgeFeatures.features.length;j++){
87+
expect(analystResult[0].nodeFeatures.features[j].type).toBe("Feature");
88+
expect(analystResult[0].nodeFeatures.features[j].geometry).not.toBeNull();
89+
expect(analystResult[0].nodeFeatures.features[j].id).not.toBeNull();
90+
expect(analystResult[0].nodeFeatures.features[j].properties).not.toBeNull();
91+
}
92+
expect(analystResult[0].nodeFeatures.features[0].id).toEqual(3030);
93+
expect(analystResult[0].nodeFeatures.features[0].geometry.type).toBe("Point");
94+
expect(analystResult[0].nodeFeatures.features[0].geometry.coordinates.length).toBeGreaterThan(0);
7595
expect(analystResult[0].nodeFeatures.features[0].properties.ID).toEqual(3030);
7696
expect(analystResult[0].pathGuideItems).not.toBeNull();
97+
expect(analystResult[0].pathGuideItems.type).toBe("FeatureCollection");
98+
expect(analystResult[0].pathGuideItems.features.length).toBeGreaterThan(0);
7799
expect(analystResult[0].route).not.toBeNull();
78-
100+
expect(analystResult[0].route.type).toBe("Feature");
79101
findTSPPathsService.destroy();
80102
expect(findTSPPathsService.EVENT_TYPES).toBeNull();
81103
expect(findTSPPathsService.events).toBeNull();
@@ -121,11 +143,10 @@ describe('testFindTSPPathsService_processAsync',function(){
121143

122144
setTimeout(function(){
123145
try{
146+
expect(serviceFailedEventArgsSystem.type).toBe("processFailed");
124147
expect(serviceFailedEventArgsSystem.error.code).toEqual(400);
125148
expect(serviceFailedEventArgsSystem.error.errorMsg).not.toBeNull();
126149
findTSPPathsService.destroy();
127-
expect(findTSPPathsService.EVENT_TYPES).toBeNull();
128-
expect(findTSPPathsService.events).toBeNull();
129150
parameter.destroy();
130151
done();
131152
}catch (exception){
@@ -168,11 +189,10 @@ describe('testFindTSPPathsService_processAsync',function(){
168189

169190
setTimeout(function(){
170191
try{
192+
expect(serviceFailedEventArgsSystem.type).toBe("processFailed");
171193
expect(serviceFailedEventArgsSystem.error.code).toEqual(400);
172194
expect(serviceFailedEventArgsSystem.error.errorMsg).not.toBeNull();
173195
findTSPPathsService.destroy();
174-
expect(findTSPPathsService.EVENT_TYPES).toBeNull();
175-
expect(findTSPPathsService.events).toBeNull();
176196
parameter.destroy();
177197
done();
178198
}catch (exception){
@@ -189,14 +209,12 @@ describe('testFindTSPPathsService_processAsync',function(){
189209
it('parameterNull',function(done){
190210
var findTSPPathsService = initFindTSPPathService();
191211
findTSPPathsService.processAsync();
192-
193212
setTimeout(function(){
194213
try{
214+
expect(serviceFailedEventArgsSystem.type).toBe("processFailed");
195215
expect(serviceFailedEventArgsSystem.error.code).toEqual(400);
196216
expect(serviceFailedEventArgsSystem.error.errorMsg).not.toBeNull();
197217
findTSPPathsService.destroy();
198-
expect(findTSPPathsService.EVENT_TYPES).toBeNull();
199-
expect(findTSPPathsService.events).toBeNull();
200218
done();
201219
}catch (exception){
202220
expect(false).toBeTruthy();
@@ -238,10 +256,10 @@ describe('testFindTSPPathsService_processAsync',function(){
238256

239257
setTimeout(function(){
240258
try{
241-
expect(serviceFailedEventArgsSystem.error).toEqual("tsppath");
259+
expect(serviceFailedEventArgsSystem.type).toBe("processFailed");
260+
expect(serviceFailedEventArgsSystem.error.code).toEqual(400);
261+
expect(serviceFailedEventArgsSystem.error.errorMsg).not.toBeNull();
242262
findTSPPathsService.destroy();
243-
expect(findTSPPathsService.EVENT_TYPES).toBeNull();
244-
expect(findTSPPathsService.events).toBeNull();
245263
parameter.destroy();
246264
done();
247265
}catch (exception){

0 commit comments

Comments
 (0)