Skip to content

Commit dcc1a5e

Browse files
committed
【fix】UT
1 parent 9f3dd07 commit dcc1a5e

File tree

1 file changed

+35
-40
lines changed

1 file changed

+35
-40
lines changed

test/maplibregl/overlay/symbol/MapExtendSymbolSpec.js

Lines changed: 35 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,8 @@ describe('maplibregl_MapExtendSymbol', () => {
77
// var populationUrl = GlobeParameter.populationURL;
88
var testDiv, map;
99
var originalTimeout;
10-
// 尝试解决方法来源 https://github.com/jestjs/jest/issues/1256
11-
var createMap = () => {
12-
return new Promise((resolve) => {
13-
var map = new maplibregl.Map({
14-
container: 'map',
15-
style: {
16-
"version": 8,
17-
"sources": {
18-
/* "raster-tiles": {
19-
"type": "raster",
20-
"tiles": [url + '/zxyTileImage.png?z={z}&x={x}&y={y}'],
21-
"tileSize": 256
22-
},
23-
"全国人口密度空间分布图": {
24-
"tiles": [
25-
populationUrl + "/tileFeature.mvt?z={z}&x={x}&y={y}"
26-
],
27-
"type": "vector"
28-
} */
29-
},
30-
"layers": [/* {
31-
"id": "simple-tiles",
32-
"type": "raster",
33-
"source": "raster-tiles",
34-
"minzoom": 0,
35-
"maxzoom": 22
36-
} */]
37-
},
38-
center: [116.40, 39.79],
39-
zoom: 3
40-
});
41-
map.on('load', function () {
42-
resolve(map);
43-
});
44-
})
45-
}
46-
beforeAll(async (done) => {
10+
11+
beforeAll((done) => {
4712
new maplibregl.supermap.WebSymbol().init();
4813
testDiv = document.createElement("div");
4914
testDiv.setAttribute("id", "map");
@@ -53,9 +18,39 @@ describe('maplibregl_MapExtendSymbol', () => {
5318
testDiv.style.width = "500px";
5419
testDiv.style.height = "500px";
5520
document.body.appendChild(testDiv);
56-
map = await createMap();
57-
done();
58-
});
21+
map = new maplibregl.Map({
22+
container: 'map',
23+
style: {
24+
"version": 8,
25+
"sources": {
26+
/* "raster-tiles": {
27+
"type": "raster",
28+
"tiles": [url + '/zxyTileImage.png?z={z}&x={x}&y={y}'],
29+
"tileSize": 256
30+
},
31+
"全国人口密度空间分布图": {
32+
"tiles": [
33+
populationUrl + "/tileFeature.mvt?z={z}&x={x}&y={y}"
34+
],
35+
"type": "vector"
36+
} */
37+
},
38+
"layers": [/* {
39+
"id": "simple-tiles",
40+
"type": "raster",
41+
"source": "raster-tiles",
42+
"minzoom": 0,
43+
"maxzoom": 22
44+
} */]
45+
},
46+
center: [116.40, 39.79],
47+
zoom: 3
48+
});
49+
map.on('load', function () {
50+
done();
51+
});
52+
53+
}, 50000);
5954
beforeEach(() => {
6055
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
6156
jasmine.DEFAULT_TIMEOUT_INTERVAL = 50000;

0 commit comments

Comments
 (0)