Skip to content

Commit 17ee963

Browse files
committed
【ut】fix UT
1 parent 9ddb5b0 commit 17ee963

File tree

15 files changed

+97
-72
lines changed

15 files changed

+97
-72
lines changed

test/mapboxgl/core/MapExtendSpec.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import mapboxgl from 'mapbox-gl';
2-
import mapboxglMock from '../../tool/mock_mapboxgl_map';
2+
import mapboxglMock, { revertCRS } from '../../tool/mock_mapboxgl_map';
33
import { FetchRequest } from '../../../src/common/util/FetchRequest';
44
import cipher from 'node-forge/lib/cipher';
55
import { MapExtend } from '../../../src/mapboxgl/core/MapExtend';
@@ -173,6 +173,9 @@ describe('MapExtend mapboxgl', () => {
173173
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
174174
jasmine.DEFAULT_TIMEOUT_INTERVAL = 50000;
175175
});
176+
afterEach(() => {
177+
revertCRS();
178+
});
176179
afterAll(() => {
177180
document.body.removeChild(testDiv);
178181
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;

test/mapboxgl/mapping/InitMapSpec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import mapboxgl from 'mapbox-gl';
2-
import mbglmap from '../../tool/mock_mapboxgl_map';
2+
import mbglmap, { revertCRS }from '../../tool/mock_mapboxgl_map';
33
import { initMap } from '../../../src/mapboxgl/mapping/InitMap';
44
import { FetchRequest } from '../../../src/common/util/FetchRequest';
55
import { SecurityManager } from '../../../src/common/security/SecurityManager';
@@ -23,6 +23,7 @@ describe('mapboxgl_InitMap', () => {
2323
});
2424

2525
afterEach(() => {
26+
revertCRS();
2627
window.document.body.removeChild(testDiv);
2728
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
2829
});

test/mapboxgl/mapping/VideoMapSpec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { VideoMap } from '../../../src/mapboxgl/mapping/VideoMap';
22
import mapboxgl from 'mapbox-gl';
3-
import mbglmap from '../../tool/mock_mapboxgl_map';
3+
import mbglmap, { revertCRS } from '../../tool/mock_mapboxgl_map';
44
var videoUrl = 'base/resources/data/test.mp4';
55
describe('mapboxgl_videoMap', () => {
66
var originalTimeout;
@@ -45,6 +45,7 @@ describe('mapboxgl_videoMap', () => {
4545
};
4646
});
4747
afterEach(() => {
48+
revertCRS();
4849
document.body.removeChild(testDiv);
4950
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
5051
});

test/mapboxgl/mapping/WebMapSpec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import mapboxgl from 'mapbox-gl';
2-
import mbglmap, { CRS, proj4 } from '../../tool/mock_mapboxgl_map';
2+
import mbglmap, { CRS, proj4, revertCRS } from '../../tool/mock_mapboxgl_map';
33
import { WebMap } from '../../../src/mapboxgl/mapping/WebMap';
44
import * as MapManagerUtil from '../../../src/mapboxgl/mapping/webmap/MapManager';
55
import { FetchRequest } from '../../../src/common/util/FetchRequest';
@@ -40,6 +40,7 @@ describe('mapboxgl_WebMap', () => {
4040
mapboxgl.CRS = undefined;
4141
mapboxgl.proj4 = undefined;
4242
window.jsonsql = undefined;
43+
revertCRS();
4344
});
4445
it('initialize_TIANDITU_VEC', (done) => {
4546
spyOn(FetchRequest, 'get').and.callFake((url) => {

test/mapboxgl/mapping/WebMapV22Spec.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import mapboxgl from 'mapbox-gl';
2-
import mbglmap, { CRS, proj4 } from '../../tool/mock_mapboxgl_map.js';
2+
import mbglmap, { CRS, proj4, revertCRS } from '../../tool/mock_mapboxgl_map.js';
33
import { WebMap } from '../../../src/mapboxgl/mapping/WebMap.js';
44
import * as MapManagerUtil from '../../../src/mapboxgl/mapping/webmap/MapManager.js';
55
import { ArrayStatistic } from '@supermapgis/iclient-common/util/ArrayStatistic.js';
@@ -229,6 +229,7 @@ describe('mapboxgl_WebMapV2_2', () => {
229229
window.geostats = undefined;
230230
window.EchartsLayer = undefined;
231231
dataFlowServiceSpyTest = null;
232+
revertCRS();
232233
});
233234

234235
it('ZXYTILE baseLayer 2326', (done) => {
@@ -475,7 +476,7 @@ describe('mapboxgl_WebMapV2_2', () => {
475476
});
476477
});
477478

478-
xit('createOverlayLayer_mvt', (done) => {
479+
it('createOverlayLayer_mvt', (done) => {
479480
let options = {
480481
server: server
481482
};

test/mapboxgl/mapping/WebMapV2Spec.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import mapboxgl from 'mapbox-gl';
2-
import mbglmap, { CRS, proj4 } from '../../tool/mock_mapboxgl_map';
2+
import mbglmap, { CRS, proj4, revertCRS } from '../../tool/mock_mapboxgl_map';
33
import { WebMap } from '../../../src/mapboxgl/mapping/WebMap';
44
import * as MapManagerUtil from '../../../src/mapboxgl/mapping/webmap/MapManager';
55
import { ArrayStatistic } from '../../../src/common/util/ArrayStatistic';
@@ -351,6 +351,7 @@ describe('mapboxgl_WebMapV2', () => {
351351
window.geostats = undefined;
352352
window.EchartsLayer = undefined;
353353
dataFlowServiceSpyTest = null;
354+
revertCRS();
354355
});
355356

356357
it('test baseLayer layers count maploaded', (done) => {
@@ -773,7 +774,7 @@ describe('mapboxgl_WebMapV2', () => {
773774
datavizWebmap.on('mapcreatesucceeded', callback);
774775
});
775776

776-
it('add rangeLayer last end === fieldValue', (done) => {
777+
it('add rangeLayer last end === fieldValue', (done) => {
777778
spyOn(FetchRequest, 'get').and.callFake((url) => {
778779
if (url.indexOf('web/datas/1171594968/content.json') > -1) {
779780
return Promise.resolve(new Response(layerData_CSV));
@@ -2866,9 +2867,7 @@ describe('mapboxgl_WebMapV2', () => {
28662867
const xyzLayer = layers[0];
28672868
expect(xyzLayer.id).toBe('2326底图');
28682869
expect(xyzLayer.type).toBe('raster');
2869-
expect(sources['2326底图'].bounds).toEqual([
2870-
113.77925526971052, 22.086139328930617, 114.53407583886273, 22.61831019233164
2871-
]);
2870+
expect(sources['2326底图'].bounds[0]).toBeCloseTo(113.77925526971052,0.001)
28722871
done();
28732872
});
28742873
});

test/mapboxgl/mapping/WebMapV3Spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { featureFilter, expression } from '@mapbox/mapbox-gl-style-spec';
1010
import spec from '@mapbox/mapbox-gl-style-spec/reference/v8';
1111
import { L7, L7Layer } from '../../../src/mapboxgl/overlay/L7Layer';
1212
import * as mockL7 from '../../tool/mock_l7';
13-
import mbglmap, { CRS, proj4 } from '../../tool/mock_mapboxgl_map';
13+
import mbglmap, { CRS, proj4, revertCRS } from '../../tool/mock_mapboxgl_map';
1414
import '../../resources/WebMapV3.js';
1515
import '../../resources/WebMapV5.js';
1616

@@ -54,6 +54,7 @@ describe('mapboxgl-webmap3.0', () => {
5454
mbglmap.prototype.getL7Scene = undefined;
5555
mapboxgl.CRS = undefined;
5656
mapboxgl.proj4 = undefined;
57+
revertCRS();
5758
});
5859

5960
it('initialize_background', (done) => {

test/mapboxgl/overlay/HeatMapLayerSpec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { HeatMapLayer } from '../../../src/mapboxgl/overlay/HeatMapLayer';
22
import mapboxgl from 'mapbox-gl';
3-
import mbglmap from '../../tool/mock_mapboxgl_map';
3+
import mbglmap, { revertCRS } from '../../tool/mock_mapboxgl_map';
44
import { truncate } from '@turf/turf';
55

66
var url = GlobeParameter.worldMapURL;
@@ -73,12 +73,12 @@ describe('mapboxgl_HeatMapLayer', () => {
7373

7474
});
7575
beforeEach(() => {
76-
7776
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
7877
jasmine.DEFAULT_TIMEOUT_INTERVAL = 50000;
7978
});
8079
afterEach(() => {
8180
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
81+
revertCRS();
8282
});
8383
afterAll(() => {
8484
window.document.body.removeChild(testDiv);

test/mapboxgl/overlay/L7LayerSpec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import mapboxgl from 'mapbox-gl';
2-
import mbglmap from '../../tool/mock_mapboxgl_map';
2+
import mbglmap, { revertCRS } from '../../tool/mock_mapboxgl_map';
33
import * as L7 from '../../../src/mapboxgl/overlay/L7/l7-render';
44
import * as mockL7 from '../../tool/mock_l7';
55
import { L7Layer } from '../../../src/mapboxgl/overlay/L7Layer';
@@ -80,6 +80,7 @@ describe('mapboxgl_L7Layer', () => {
8080

8181
afterEach(() => {
8282
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
83+
revertCRS();
8384
});
8485

8586
afterAll(() => {

test/mapboxgl/overlay/MapvLayerSpec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {MapvLayer} from '../../../src/mapboxgl/overlay/MapvLayer';
22
import mapboxgl from 'mapbox-gl';
33
import {utilCityCenter, DataSet} from 'mapv';
4-
import mbglmap from '../../tool/mock_mapboxgl_map';
4+
import mbglmap, { revertCRS } from '../../tool/mock_mapboxgl_map';
55

66
var url = GlobeParameter.ChinaURL + '/zxyTileImage.png?z={z}&x={x}&y={y}';
77

@@ -89,6 +89,7 @@ describe('mapboxgl_MapVLayer', () => {
8989
}
9090
dataSet = null;
9191
data = [];
92+
revertCRS();
9293
});
9394
afterAll(() => {
9495
document.body.removeChild(testDiv);

0 commit comments

Comments
 (0)