Skip to content

Commit 2c8bb4c

Browse files
committed
【UT】优化UT
1 parent 95e922f commit 2c8bb4c

File tree

1 file changed

+24
-29
lines changed

1 file changed

+24
-29
lines changed

test/common/iServer/GetGridCellInfosServiceSpec.js

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,20 @@ describe('GetGridCellInfosService', () => {
7373
});
7474
var queryCompleted = event => {
7575
eventCompleted = event;
76+
try {
77+
expect(myService.url).toEqual(
78+
dataServiceURL + '/datasources/World/datasets/LandCover/gridValue?x=110&y=50'
79+
);
80+
myService.destroy();
81+
queryParam.destroy();
82+
done();
83+
} catch (exception) {
84+
expect(false).toBeTruthy();
85+
console.log('GetGridCellInfosService_' + exception.name + ':' + exception.message);
86+
myService.destroy();
87+
queryParam.destroy();
88+
done();
89+
}
7690
};
7791
var queryError = event => {
7892
eventFailed = event;
@@ -97,23 +111,6 @@ describe('GetGridCellInfosService', () => {
97111
return null;
98112
});
99113
myService.processAsync(queryParam);
100-
101-
setTimeout(() => {
102-
try {
103-
expect(myService.url).toEqual(
104-
dataServiceURL + '/datasources/World/datasets/LandCover/gridValue?x=110&y=50'
105-
);
106-
myService.destroy();
107-
queryParam.destroy();
108-
done();
109-
} catch (exception) {
110-
expect(false).toBeTruthy();
111-
console.log('GetGridCellInfosService_' + exception.name + ':' + exception.message);
112-
myService.destroy();
113-
queryParam.destroy();
114-
done();
115-
}
116-
}, 0);
117114
});
118115

119116
it('fail:processAsync', done => {
@@ -133,18 +130,16 @@ describe('GetGridCellInfosService', () => {
133130
Y: 50
134131
});
135132
myService.processAsync();
136-
setTimeout(() => {
137-
try {
138-
expect(myService.processAsync() === undefined).toBeTruthy();
139-
myService.destroy();
140-
done();
141-
} catch (exception) {
142-
expect(false).toBeTruthy();
143-
console.log('GetGridCellInfosService_' + exception.name + ':' + exception.message);
144-
myService.destroy();
145-
done();
146-
}
147-
}, 0);
133+
try {
134+
expect(myService.processAsync() === undefined).toBeTruthy();
135+
myService.destroy();
136+
done();
137+
} catch (exception) {
138+
expect(false).toBeTruthy();
139+
console.log('GetGridCellInfosService_' + exception.name + ':' + exception.message);
140+
myService.destroy();
141+
done();
142+
}
148143
});
149144

150145
it('getDatasetInfoCompleted', () => {

0 commit comments

Comments
 (0)