Skip to content

Commit 21bb83b

Browse files
committed
fix ut
1 parent a9b65a7 commit 21bb83b

File tree

9 files changed

+23
-31
lines changed

9 files changed

+23
-31
lines changed

test/common/iServer/GetGridCellInfosServiceSpec.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,7 @@ describe('testGetGridCellInfosService_processAsync',function(){
6666

6767
setTimeout(function() {
6868
try{
69-
if (myService.isInTheSameDomain) {
70-
expect(myService.url).toEqual(dataServiceURL + "/datasources/World/datasets/LandCover/gridValue.json?x=110&y=50");
71-
} else {
72-
expect(myService.url).toEqual(dataServiceURL + "/datasources/World/datasets/LandCover/gridValue.jsonp?x=110&y=50");
73-
}
69+
expect(myService.url).toEqual(dataServiceURL + "/datasources/World/datasets/LandCover/gridValue.json?x=110&y=50");
7470
myService.destroy();
7571
queryParam.destroy();
7672
done();
@@ -127,7 +123,7 @@ describe('testGetGridCellInfosService_getDatasetInfoCompleted',function(){
127123
type: "GRID"
128124
}
129125
};
130-
myService.url = dataServiceURL + "/datasources/World/datasets/LandCover.jsonp";
126+
myService.url = dataServiceURL + "/datasources/World/datasets/LandCover.json";
131127
myService.getDatasetInfoCompleted(result);
132128
expect(myService.datasetType).toBe("GRID");
133129
});
@@ -144,12 +140,12 @@ describe('testGetGridCellInfosService_getDatasetInfoFailed',function(){
144140

145141
describe('testGetGridCellInfosService_queryGridInfos',function(){
146142
it('queryGridInfos',function(){
147-
var url = dataServiceURL + "/datasources/World/datasets/LandCover.jsonp";
143+
var url = dataServiceURL + "/datasources/World/datasets/LandCover.json";
148144
var myService = initGetGridCellInfosService(url);
149145
myService.X = "110";
150146
myService.Y = "50";
151147
myService.queryGridInfos();
152-
expect(myService.url).toEqual(dataServiceURL + "/datasources/World/datasets/LandCover/imageValue.jsonp?x=110&y=50");
148+
expect(myService.url).toEqual(dataServiceURL + "/datasources/World/datasets/LandCover/imageValue.json?x=110&y=50");
153149
});
154150
});
155151

test/common/iServer/MapServiceSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe('testMapService_processAsync',function(){
4646
it('pass',function(done){
4747
var getMapService = initMapService_RegisterListener();
4848
expect(getMapService).not.toBeNull();
49-
expect(getMapService.url).toEqual(worldMapURL+".jsonp");
49+
expect(getMapService.url).toEqual(worldMapURL+".json");
5050
getMapService.processAsync();
5151

5252
setTimeout(function() {

test/common/iServer/QueryByBoundsServiceSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('testQueryByBoundsService_constructor',function(){
2828
it('constructor and destroy',function(){
2929
var queryByBoundsService = initQueryByBoundsService();
3030
expect(queryByBoundsService).not.toBeNull();
31-
expect(queryByBoundsService.url).toEqual(worldMapURL + "/queryResults.jsonp?");
31+
expect(queryByBoundsService.url).toEqual(worldMapURL + "/queryResults.json?");
3232
queryByBoundsService.destroy();
3333
expect(queryByBoundsService.EVENT_TYPES).toBeNull();
3434
expect(queryByBoundsService.events).toBeNull();

test/common/iServer/QueryByDistanceServiceSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('testQueryByBoundsService_constructor',function(){
2828
it('constructor and destroy',function(){
2929
var queryByDistanceService = initQueryByDistanceService();
3030
expect(queryByDistanceService).not.toBeNull();
31-
expect(queryByDistanceService.url).toEqual(worldMapURL+ "/queryResults.jsonp?");
31+
expect(queryByDistanceService.url).toEqual(worldMapURL+ "/queryResults.json?");
3232
queryByDistanceService.destroy();
3333
expect(queryByDistanceService.EVENT_TYPES).toBeNull();
3434
expect(queryByDistanceService.events).toBeNull();

test/common/iServer/QueryByGeometryServiceSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('testQueryByGeometryService_constructor',function(){
2929
it('constructor and destroy',function(){
3030
var queryByGeometryService = initQueryByGeometryService();
3131
expect(queryByGeometryService).not.toBeNull();
32-
expect(queryByGeometryService.url).toEqual(worldMapURL+ "/queryResults.jsonp?");
32+
expect(queryByGeometryService.url).toEqual(worldMapURL+ "/queryResults.json?");
3333
queryByGeometryService.destroy();
3434
expect(queryByGeometryService.EVENT_TYPES).toBeNull();
3535
expect(queryByGeometryService.events).toBeNull();

test/common/iServer/QueryBySQLServiceSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ describe('testQueryBySQLService_constructor', function () {
44
it('constructor and destroy', function () {
55
var queryBySQLService = new SuperMap.QueryBySQLService(worldMapURL);
66
expect(queryBySQLService).not.toBeNull();
7-
expect(queryBySQLService.url).toEqual(worldMapURL + "/queryResults.jsonp?");
7+
expect(queryBySQLService.url).toEqual(worldMapURL + "/queryResults.json?");
88
queryBySQLService.destroy();
99
expect(queryBySQLService.EVENT_TYPES).toBeNull();
1010
expect(queryBySQLService.events).toBeNull();

test/common/iServer/QueryServiceSpec.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ describe('testQueryService',function(){
99
it("constructor",function(){
1010
var queryServices = initQueryService();
1111
expect(queryServices).not.toBeNull();
12-
if(queryServices.isInTheSameDomain) {
13-
expect(queryServices.url).toEqual(url + "/queryResults.json?");
14-
} else {
15-
expect(queryServices.url).toEqual(url + "/queryResults.jsonp?");
16-
}
12+
expect(queryServices.url).toEqual(url + "/queryResults.json?");
1713
});
1814
});

test/common/iServer/ThemeServiceSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe('testThemeService_processAsync', function () {
7373
});
7474
themeRange.items = new Array(themeRangeItem1, themeRangeItem2, themeRangeItem3);
7575
expect(themeService).not.toBeNull();
76-
expect(themeService.url).toEqual(themeURL+"/tempLayersSet.jsonp?");
76+
expect(themeService.url).toEqual(themeURL+"/tempLayersSet.json?");
7777
var themeParameters = new SuperMap.ThemeParameters({
7878
datasetNames: new Array("Countries"),
7979
dataSourceNames: new Array("World"),

test/openlayers/core/StyleUtilsSpec.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ require('../../../src/openlayers/core/StyleUtils.js');
22
require('../../tool/china_cartoCSS.js');
33
require('../../tool/china_layers.js');
44
require('../../tool/iPortal_maps.js');
5-
var fetchJsonp=require('fetch-jsonp');
5+
var fetch=require('whatwg-fetch-importable');
66

77
var StyleUtils = ol.supermap.StyleUtils;
88
var layersInfo, cartoCSSShaders, iPortalLayersInfo;
@@ -24,7 +24,7 @@ describe('openlayers_testStyleUtils', function () {
2424

2525
//测试从图层信息中获取style
2626
it('getValidStyleFromLayerInfo_point', function (done) {
27-
var tileFeatureUrl = mapUrl + "/tileFeature.jsonp?returnAttributes=true&x=420&y=195&width=256&height=256&scale=8.653637486605572e-7";
27+
var tileFeatureUrl = mapUrl + "/tileFeature.json?returnAttributes=true&x=420&y=195&width=256&height=256&scale=8.653637486605572e-7";
2828
var request = requestFeature(tileFeatureUrl);
2929
request.then(function (features) {
3030
try {
@@ -55,7 +55,7 @@ describe('openlayers_testStyleUtils', function () {
5555

5656
//测试从图层信息中获取style
5757
it('getValidStyleFromLayerInfo_polyLine', function (done) {
58-
var tileFeatureUrl = mapUrl + "/tileFeature.jsonp?returnAttributes=true&x=420&y=193&width=256&height=256&scale=8.653637486605572e-7";
58+
var tileFeatureUrl = mapUrl + "/tileFeature.json?returnAttributes=true&x=420&y=193&width=256&height=256&scale=8.653637486605572e-7";
5959
var request = requestFeature(tileFeatureUrl);
6060
request.then(function (features) {
6161
try {
@@ -85,7 +85,7 @@ describe('openlayers_testStyleUtils', function () {
8585

8686
//测试从图层信息中获取style
8787
it('getValidStyleFromLayerInfo_polygon', function (done) {
88-
var tileFeatureUrl = mapUrl + "/tileFeature.jsonp?returnAttributes=true&x=1686&y=775&width=256&height=256&scale=0.00000346145499464224";
88+
var tileFeatureUrl = mapUrl + "/tileFeature.json?returnAttributes=true&x=1686&y=775&width=256&height=256&scale=0.00000346145499464224";
8989
var request = requestFeature(tileFeatureUrl);
9090
request.then(function (features) {
9191
try {
@@ -119,7 +119,7 @@ describe('openlayers_testStyleUtils', function () {
119119

120120
//测试从图层信息中获取style
121121
it('getValidStyleFromLayerInfo_text1', function (done) {
122-
var tileFeatureUrl = mapUrl + "/tileFeature.jsonp?returnAttributes=true&x=1689&y=775&width=256&height=256&scale=0.00000346145499464224";
122+
var tileFeatureUrl = mapUrl + "/tileFeature.json?returnAttributes=true&x=1689&y=775&width=256&height=256&scale=0.00000346145499464224";
123123
var request = requestFeature(tileFeatureUrl);
124124
request.then(function (features) {
125125
try {
@@ -148,7 +148,7 @@ describe('openlayers_testStyleUtils', function () {
148148

149149
//测试从图层信息中获取style
150150
it('getValidStyleFromLayerInfo_text2', function (done) {
151-
var tileFeatureUrl = mapUrl + "/tileFeature.jsonp?returnAttributes=true&x=28&y=13&width=256&height=256&scale=5.408523429128511e-8";
151+
var tileFeatureUrl = mapUrl + "/tileFeature.json?returnAttributes=true&x=28&y=13&width=256&height=256&scale=5.408523429128511e-8";
152152
var request = requestFeature(tileFeatureUrl);
153153
request.then(function (features) {
154154
try {
@@ -178,7 +178,7 @@ describe('openlayers_testStyleUtils', function () {
178178

179179
//测试从CartoCSS中获取style
180180
it('getStyleFromCarto_point1', function (done) {
181-
var tileFeatureUrl = mapUrl + "/tileFeature.jsonp?returnAttributes=true&x=420&y=195&width=256&height=256&scale=8.653637486605572e-7";
181+
var tileFeatureUrl = mapUrl + "/tileFeature.json?returnAttributes=true&x=420&y=195&width=256&height=256&scale=8.653637486605572e-7";
182182
var request = requestFeature(tileFeatureUrl);
183183
request.then(function (features) {
184184
try {
@@ -209,7 +209,7 @@ describe('openlayers_testStyleUtils', function () {
209209

210210
//测试从CartoCSS中获取style
211211
it('getStyleFromCarto_point2', function (done) {
212-
var tileFeatureUrl = mapUrl + "/tileFeature.jsonp?returnAttributes=true&x=1687&y=774&width=256&height=256&scale=0.00000346145499464224";
212+
var tileFeatureUrl = mapUrl + "/tileFeature.json?returnAttributes=true&x=1687&y=774&width=256&height=256&scale=0.00000346145499464224";
213213
var request = requestFeature(tileFeatureUrl);
214214
request.then(function (features) {
215215
try {
@@ -239,7 +239,7 @@ describe('openlayers_testStyleUtils', function () {
239239

240240
//测试从CartoCSS中获取style
241241
it('getStyleFromCarto_polyLine', function (done) {
242-
var tileFeatureUrl = mapUrl + "/tileFeature.jsonp?returnAttributes=true&x=420&y=193&width=256&height=256&scale=8.653637486605572e-7";
242+
var tileFeatureUrl = mapUrl + "/tileFeature.json?returnAttributes=true&x=420&y=193&width=256&height=256&scale=8.653637486605572e-7";
243243
var request = requestFeature(tileFeatureUrl);
244244
request.then(function (features) {
245245
try {
@@ -269,7 +269,7 @@ describe('openlayers_testStyleUtils', function () {
269269

270270
//测试从CartoCSS中获取style
271271
it('getStyleFromCarto_polygon', function (done) {
272-
var tileFeatureUrl = mapUrl + "/tileFeature.jsonp?returnAttributes=true&x=1686&y=775&width=256&height=256&scale=0.00000346145499464224";
272+
var tileFeatureUrl = mapUrl + "/tileFeature.json?returnAttributes=true&x=1686&y=775&width=256&height=256&scale=0.00000346145499464224";
273273
var request = requestFeature(tileFeatureUrl);
274274
request.then(function (features) {
275275
try {
@@ -300,7 +300,7 @@ describe('openlayers_testStyleUtils', function () {
300300

301301
//测试从CartoCSS中获取style
302302
it('getStyleFromCarto_text', function (done) {
303-
var tileFeatureUrl = mapUrl + "/tileFeature.jsonp?returnAttributes=true&x=1689&y=775&width=256&height=256&scale=0.00000346145499464224";
303+
var tileFeatureUrl = mapUrl + "/tileFeature.json?returnAttributes=true&x=1689&y=775&width=256&height=256&scale=0.00000346145499464224";
304304
var request = requestFeature(tileFeatureUrl);
305305
request.then(function (features) {
306306
try {
@@ -505,7 +505,7 @@ function getShader(layerName) {
505505
function requestFeature(url) {
506506
var tileFormat = new ol.format.GeoJSON();
507507

508-
return fetchJsonp(url, {method: 'GET', timeout: 10000})
508+
return fetch(url, {method: 'GET', timeout: 10000})
509509
.then(function (response) {
510510
return response.json();
511511
}).then(function (tileFeatureJson) {

0 commit comments

Comments
 (0)