Skip to content

Commit 4ec5619

Browse files
committed
【ut】fix ut
1 parent 9b3fefb commit 4ec5619

File tree

3 files changed

+26
-23
lines changed

3 files changed

+26
-23
lines changed

test/mapboxgl/mapping/WebMapSpec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import * as MapManagerUtil from '../../../src/mapboxgl/mapping/webmap/MapManager
55
import { FetchRequest } from '@supermapgis/iclient-common/util/FetchRequest';
66
import { ArrayStatistic } from '@supermapgis/iclient-common/util/ArrayStatistic';
77
import '../../resources/WebMapV5.js';
8-
window.jsonsql = { query: () => {} };
98

109
describe('mapboxgl_WebMap', () => {
1110
var originalTimeout, testDiv;
@@ -26,6 +25,7 @@ describe('mapboxgl_WebMap', () => {
2625
window.document.body.appendChild(testDiv);
2726
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
2827
jasmine.DEFAULT_TIMEOUT_INTERVAL = 50000;
28+
window.jsonsql = { query: () => {} };
2929
});
3030
afterEach(() => {
3131
if (datavizWebmap && datavizWebmap.map) {
@@ -36,6 +36,7 @@ describe('mapboxgl_WebMap', () => {
3636
window.document.body.removeChild(testDiv);
3737
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
3838
mapboxgl.CRS = undefined;
39+
window.jsonsql = undefined;
3940
});
4041
it('initialize_TIANDITU_VEC', (done) => {
4142
spyOn(FetchRequest, 'get').and.callFake((url) => {

test/maplibregl/mapping/WebMapSpec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import * as MapManagerUtil from '../../../src/maplibregl/mapping/webmap/MapManag
55
import { FetchRequest } from '@supermapgis/iclient-common/util/FetchRequest';
66
import { ArrayStatistic } from '@supermapgis/iclient-common/util/ArrayStatistic';
77
import '../../resources/WebMapV5.js';
8-
window.jsonsql = { query: () => {} };
98

109
describe('maplibregl_WebMap', () => {
1110
var originalTimeout, testDiv;
@@ -26,6 +25,7 @@ describe('maplibregl_WebMap', () => {
2625
window.document.body.appendChild(testDiv);
2726
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
2827
jasmine.DEFAULT_TIMEOUT_INTERVAL = 50000;
28+
window.jsonsql = { query: () => {} };
2929
});
3030
afterEach(() => {
3131
if (datavizWebmap && datavizWebmap.map) {
@@ -36,6 +36,7 @@ describe('maplibregl_WebMap', () => {
3636
window.document.body.removeChild(testDiv);
3737
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
3838
maplibregl.CRS = undefined;
39+
window.jsonsql = undefined;
3940
});
4041
it('initialize_TIANDITU_VEC', (done) => {
4142
spyOn(FetchRequest, 'get').and.callFake((url) => {

test/maplibregl/mapping/WebMapV2Spec.js

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,6 @@ import { ArrayStatistic } from '@supermapgis/iclient-common/util/ArrayStatistic'
66
import { FetchRequest } from '@supermapgis/iclient-common/util/FetchRequest';
77
import '../../resources/WebMapV5.js';
88

9-
window.jsonsql = { query: () => [{}] };
10-
11-
window.canvg = {
12-
default: {
13-
from: (ctx, url, callback) =>
14-
Promise.resolve({ stop: jasmine.createSpy('stop'), start: jasmine.createSpy('start') })
15-
}
16-
};
17-
18-
window.geostats = class {
19-
setSerie() {}
20-
};
21-
22-
window.EchartsLayer = class {
23-
constructor() {
24-
this.chart = {
25-
setOption() {}
26-
};
27-
}
28-
};
29-
309
function DataFlowService(serviceUrl) {
3110
const dataflowFeature = {
3211
geometry: {
@@ -327,6 +306,24 @@ describe('maplibregl_WebMapV2', () => {
327306
window.document.body.appendChild(testDiv);
328307
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
329308
jasmine.DEFAULT_TIMEOUT_INTERVAL = 50000;
309+
310+
window.jsonsql = { query: () => [{}] };
311+
window.canvg = {
312+
default: {
313+
from: (ctx, url, callback) =>
314+
Promise.resolve({ stop: jasmine.createSpy('stop'), start: jasmine.createSpy('start') })
315+
}
316+
};
317+
window.geostats = class {
318+
setSerie() {}
319+
};
320+
window.EchartsLayer = class {
321+
constructor() {
322+
this.chart = {
323+
setOption() {}
324+
};
325+
}
326+
};
330327
});
331328
afterEach(() => {
332329
if (datavizWebmap) {
@@ -340,6 +337,10 @@ describe('maplibregl_WebMapV2', () => {
340337
window.document.body.removeChild(testDiv);
341338
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
342339
maplibregl.CRS = undefined;
340+
window.jsonsql = undefined;
341+
window.canvg = undefined;
342+
window.geostats = undefined;
343+
window.EchartsLayer = undefined;
343344
});
344345

345346
it('test baseLayer layers count maploaded', (done) => {

0 commit comments

Comments
 (0)