Skip to content

Commit

Permalink
[fix]UT
Browse files Browse the repository at this point in the history
  • Loading branch information
luoxiao-supermap committed Dec 2, 2024
1 parent 6849a67 commit 3044618
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions test/mapboxgl/mapping/WebMapV2Spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1414,39 +1414,7 @@ describe('mapboxgl_WebMapV2', () => {
datavizWebmap.on('mapcreatesucceeded', callback);
});

xit('updateOverlayLayer featureProjection', (done) => {
spyOn(FetchRequest, 'get').and.callFake((url) => {
if (url.indexOf('portal.json') > -1) {
return Promise.resolve(new Response(JSON.stringify(iportal_serviceProxy)));
} else if (url.indexOf('1788054202/map.json') > -1) {
uniqueLayer_polygon.layers.map(item => {
item.projection='EPSG:3857'
})
return Promise.resolve(new Response(JSON.stringify(uniqueLayer_polygon)));
} else if (url.indexOf('datas/1960447494/content.json') > -1) {
return Promise.resolve(new Response(layerData_CSV));
} else if (url.indexOf('datas/144371940/content.json')) {
return Promise.resolve(new Response(JSON.stringify(layerData_geojson['LINE_GEOJSON'])));
}
});
datavizWebmap = new WebMap(id, { ...commonOption, map: commonMap }, { ...commonMapOptions });

const callback = function (data) {
const spy = spyOn(datavizWebmap._handler, 'transformFeatures').and.callThrough();
datavizWebmap.updateOverlayLayer(
{ id: uniqueLayer_polygon.layers[0].name, projection: 'EPSG:3857' },
{
type: 'FeatureCollection',
features: [{ type: 'Feature', geometry: { type: 'Point', coordinates: [110, 10] }, properties: {} }]
},
'',
'EPSG:4326'
);
expect(spy).not.toHaveBeenCalled();
done();
};
datavizWebmap.on('mapcreatesucceeded', callback);
});


it('updateOverlayLayer unique', (done) => {
spyOn(FetchRequest, 'get').and.callFake((url) => {
Expand Down Expand Up @@ -3221,4 +3189,36 @@ describe('mapboxgl_WebMapV2', () => {
});
});
});

it('updateOverlayLayer featureProjection', (done) => {
spyOn(FetchRequest, 'get').and.callFake((url) => {
if (url.indexOf('map.json') > -1) {
webmap_rangeLayer.layers.map(item => {
item.projection = 'EPSG:3857';
});
return Promise.resolve(new Response(JSON.stringify(webmap_rangeLayer)));
} else if (url.indexOf('content.json') > -1) {
return Promise.resolve(new Response(JSON.stringify(chart_content)));
} else if (url.indexOf('portal.json') > -1) {
return Promise.resolve(new Response(JSON.stringify(iportal_serviceProxy)));
} else if (url.indexOf('ChinaDark.json') > -1) {
return Promise.resolve(new Response(JSON.stringify({})));
}
return Promise.resolve(new Response(JSON.stringify({})));
});
datavizWebmap = new WebMap(id, {
server: server
});
datavizWebmap.on('mapcreatesucceeded', ({ map }) => {
const spy = spyOn(datavizWebmap._handler, 'transformFeatures').and.callThrough();
datavizWebmap.updateOverlayLayer(
{ id: webmap_rangeLayer.layers[0].name },
[{ type: 'Feature', geometry: { type: 'Point', coordinates: [110, 10] }, properties: {} }],
'',
'EPSG:4326'
);
expect(spy).not.toHaveBeenCalled();
done();
});
});
});

0 comments on commit 3044618

Please sign in to comment.