Skip to content

Commit 6b2adbd

Browse files
修改UT。review by zhurch
1 parent 38d8893 commit 6b2adbd

File tree

7 files changed

+313
-287
lines changed

7 files changed

+313
-287
lines changed

test/Core/iServer/BufferAnalystServiceSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ describe('testBufferAnalystService_processAsync', function () {
9494
try {
9595
var bfMode = analystEventArgsSystem.result;
9696
expect(bfMode).not.toBeNull();
97-
expect(bfMode.type).toEqual("MultiPolygon");
97+
expect(bfMode.type).toEqual("Feature");
9898
bfServiceByGeometry.destroy();
9999
expect(bfServiceByGeometry.events).toBeNull();
100100
expect(bfServiceByGeometry.eventListeners).toBeNull();

test/Core/iServer/FindClosestFacilitiesServiceSpec.js

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,30 @@ var url = GlobeParameter.networkAnalystURL;
66
var options = {
77
eventListeners: {
88
'processFailed': findClosestFacilitiesServiceFailed,
9-
'processCompleted':findClosestFacilitiesServiceCompleted
9+
'processCompleted': findClosestFacilitiesServiceCompleted
1010
}
1111
};
1212
function initFindClosestFacilitiesService() {
1313
return new SuperMap.REST.FindClosestFacilitiesService(url, options);
1414
}
15-
function findClosestFacilitiesServiceCompleted(serviceSucceedEventArgs){
15+
function findClosestFacilitiesServiceCompleted(serviceSucceedEventArgs) {
1616
serviceSucceedEventArgsSystem = serviceSucceedEventArgs;
1717
}
18-
function findClosestFacilitiesServiceFailed(serviceFailedEventArgs){
18+
function findClosestFacilitiesServiceFailed(serviceFailedEventArgs) {
1919
serviceFailedEventArgsSystem = serviceFailedEventArgs;
2020
}
2121

22-
describe('testFindClosestFacilitiesService_processAsync',function(){
22+
describe('testFindClosestFacilitiesService_processAsync', function () {
2323
var originalTimeout;
24-
beforeEach(function() {
24+
beforeEach(function () {
2525
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
2626
jasmine.DEFAULT_TIMEOUT_INTERVAL = 50000;
2727
});
28-
afterEach(function() {
28+
afterEach(function () {
2929
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
3030
});
3131

32-
it('return:True',function(done){
32+
it('return:True', function (done) {
3333
var facilityPoints = [new SuperMap.Geometry.Point(119.6100397551, -122.6278394459),
3434
new SuperMap.Geometry.Point(171.9035599945, -113.2491141857)
3535
];
@@ -54,34 +54,33 @@ describe('testFindClosestFacilitiesService_processAsync',function(){
5454
var closestFacilitiesService = initFindClosestFacilitiesService();
5555
closestFacilitiesService.processAsync(parameter);
5656

57-
setTimeout(function(){
58-
try{
57+
setTimeout(function () {
58+
try {
5959
var analystResult = serviceSucceedEventArgsSystem.result;
6060
expect(closestFacilitiesService).not.toBeNull();
61-
expect(analystResult.facilityPathList).not.toBeNull();
62-
expect(analystResult.facilityPathList[0].edgeFeatures).not.toBeNull();
63-
expect(analystResult.facilityPathList[0].edgeFeatures[0].geometry).not.toBeNull();
64-
expect(analystResult.facilityPathList[0].edgeIDs).not.toBeNull();
65-
expect(analystResult.facilityPathList[0].nodeFeatures).not.toBeNull();
66-
expect(analystResult.facilityPathList[0].nodeIDs).not.toBeNull();
67-
expect(analystResult.facilityPathList[0].pathGuideItems).not.toBeNull();
68-
expect(analystResult.facilityPathList[0].route).not.toBeNull();
6961
expect(serviceSucceedEventArgsSystem).not.toBeNull();
62+
expect(analystResult[0].edgeFeatures).not.toBeNull();
63+
expect(analystResult[0].edgeFeatures.type).toEqual("FeatureCollection");
64+
expect(analystResult[0].edgeFeatures.features[0].type).toEqual("Feature");
65+
expect(analystResult[0].edgeFeatures.features[0].geometry).not.toBeNull();
66+
expect(analystResult[0].nodeFeatures).not.toBeNull();
67+
expect(analystResult[0].pathGuideItems).not.toBeNull();
68+
expect(analystResult[0].route).not.toBeNull();
7069
closestFacilitiesService.destroy();
7170
parameter.destroy();
7271
done();
73-
}catch (exception){
72+
} catch (exception) {
7473
expect(false).toBeTruthy();
75-
console.log("FieldStatisticService_" + exception.name + ":" + exception.message);
74+
console.log("FindClosestFacilitiesService_" + exception.name + ":" + exception.message);
7675
closestFacilitiesService.destroy();
7776
parameter.destroy();
7877
done();
7978
}
80-
},6000);
79+
}, 6000);
8180
});
8281

8382
// isAnalyzeById
84-
it('isAnalyzeById',function(done){
83+
it('isAnalyzeById', function (done) {
8584
var transReSetting = new TransportationAnalystResultSetting();
8685
with (transReSetting) {
8786
returnEdgeFeatures = true;
@@ -104,26 +103,26 @@ describe('testFindClosestFacilitiesService_processAsync',function(){
104103
var closestFacilitiesService = initFindClosestFacilitiesService();
105104
closestFacilitiesService.processAsync(facilitiesParams);
106105

107-
setTimeout(function(){
108-
try{
106+
setTimeout(function () {
107+
try {
109108
expect(serviceSucceedEventArgsSystem).not.toBeNull();
110109
closestFacilitiesService.destroy();
111110
expect(closestFacilitiesService.EVENT_TYPES).toBeNull();
112111
expect(closestFacilitiesService.events).toBeNull();
113112
facilitiesParams.destroy();
114113
done();
115-
}catch (exception){
114+
} catch (exception) {
116115
expect(false).toBeTruthy();
117-
console.log("FieldStatisticService_" + exception.name + ":" + exception.message);
116+
console.log("FindClosestFacilitiesService_" + exception.name + ":" + exception.message);
118117
closestFacilitiesService.destroy();
119118
facilitiesParams.destroy();
120119
done();
121120
}
122-
},6000)
121+
}, 6000)
123122
});
124123

125124
//参数为空
126-
it('parameterNull',function(done){
125+
it('parameterNull', function (done) {
127126
var transReSetting = new TransportationAnalystResultSetting();
128127
with (transReSetting) {
129128
returnEdgeFeatures = true;
@@ -146,21 +145,21 @@ describe('testFindClosestFacilitiesService_processAsync',function(){
146145
var closestFacilitiesService = initFindClosestFacilitiesService();
147146
closestFacilitiesService.processAsync();
148147

149-
setTimeout(function(){
150-
try{
148+
setTimeout(function () {
149+
try {
151150
expect(serviceSucceedEventArgsSystem.result.facilityPathList).toBeNull();
152151
closestFacilitiesService.destroy();
153152
done();
154-
}catch (exception){
153+
} catch (exception) {
155154
expect(false).toBeTruthy();
156-
console.log("FieldStatisticService_" + exception.name + ":" + exception.message);
155+
console.log("FindClosestFacilitiesService_" + exception.name + ":" + exception.message);
157156
closestFacilitiesService.destroy();
158157
done();
159158
}
160-
},6000);
159+
}, 6000);
161160
});
162161

163-
it('failedEvent',function(done){
162+
it('failedEvent', function (done) {
164163
var transReSetting = new TransportationAnalystResultSetting();
165164
with (transReSetting) {
166165
returnEdgeFeatures = true;
@@ -185,22 +184,22 @@ describe('testFindClosestFacilitiesService_processAsync',function(){
185184
var closestFacilitiesService = initFindClosestFacilitiesService();
186185
closestFacilitiesService.processAsync(facilitiesParams);
187186

188-
setTimeout(function(){
189-
try{
187+
setTimeout(function () {
188+
try {
190189
expect(serviceSucceedEventArgsSystem.result.facilityPathList).toBeNull();
191190
expect(serviceFailedEventArgsSystem.error.code).toEqual(400);
192191
expect(serviceFailedEventArgsSystem.error.errorMsg).not.toBeNull();
193192
closestFacilitiesService.destroy();
194193
facilitiesParams.destroy();
195194
done();
196-
}catch (exception){
195+
} catch (exception) {
197196
expect(false).toBeTruthy();
198-
console.log("FieldStatisticService_" + exception.name + ":" + exception.message);
197+
console.log("FindClosestFacilitiesService_" + exception.name + ":" + exception.message);
199198
closestFacilitiesService.destroy();
200199
facilitiesParams.destroy();
201200
done();
202201
}
203-
},6000)
202+
}, 6000)
204203
})
205204
});
206205

0 commit comments

Comments
 (0)