Skip to content

Commit 1849963

Browse files
committed
fix误提
1 parent 431a1e3 commit 1849963

File tree

9 files changed

+680
-585
lines changed

9 files changed

+680
-585
lines changed

test/leaflet/services/ChartServiceSpec.js

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ describe('leaflet_ChartService', () => {
120120
const service2Res = service2.getChartWaterDepth(parms);
121121
expect(service2Res).toBeNull();
122122
service.getChartWaterDepth(parms).then(res => {
123-
expect(res.result.value).toBe(12)
124-
expect(res.result.row).toBe(845)
125-
expect(res.result.column).toBe(385)
123+
expect(res.depth.result.value).toBe(12)
124+
expect(res.depth.result.row).toBe(845)
125+
expect(res.depth.result.column).toBe(385)
126126
done();
127127
})
128128
});
@@ -179,6 +179,30 @@ describe('leaflet_ChartService', () => {
179179
done();
180180
})
181181
});
182+
it('getChartMaritimePcInfo', (done) => {
183+
var service = chartService(url, options);
184+
spyOn(FetchRequest, 'commit').and.callFake((method, testUrl, params, options) => {
185+
expect(method).toBe("GET");
186+
expect(testUrl).toBe(url + "/maritimepcinfo");
187+
expect(options).not.toBeNull();
188+
return Promise.resolve(new Response(JSON.stringify(maritimepcinfo)));
189+
});
190+
service.getChartMaritimePcInfo((result) => {
191+
serviceResult = result;
192+
try {
193+
expect(service).not.toBeNull();
194+
expect(serviceResult).not.toBeNull();
195+
expect(serviceResult.type).toEqual("processCompleted");
196+
var result = serviceResult.result;
197+
expect(result).not.toBeNull();
198+
done();
199+
} catch (e) {
200+
console.log("'getChartMaritimePcInfo'案例失败" + e.name + ":" + e.message);
201+
expect(false).toBeTruthy();
202+
done();
203+
}
204+
});
205+
});
182206
it('_processFormat', (done) => {
183207
var service = chartService(url, {});
184208
expect(service._processFormat()).not.toBeFalsy();

test/mapboxgl/services/ChartServiceSpec.js

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ describe('mapboxgl_ChartService', () => {
120120
const service2Res = service2.getChartWaterDepth(parms);
121121
expect(service2Res).toBeNull();
122122
service.getChartWaterDepth(parms).then(res => {
123-
expect(res.result.value).toBe(12)
124-
expect(res.result.row).toBe(845)
125-
expect(res.result.column).toBe(385)
123+
expect(res.depth.result.value).toBe(12)
124+
expect(res.depth.result.row).toBe(845)
125+
expect(res.depth.result.column).toBe(385)
126126
done();
127127
})
128128
});
@@ -179,7 +179,30 @@ describe('mapboxgl_ChartService', () => {
179179
done();
180180
})
181181
});
182-
182+
it('getChartMaritimePcInfo', (done) => {
183+
var service = new ChartService(url, dataUrl, options);
184+
spyOn(FetchRequest, 'commit').and.callFake((method, testUrl, params, options) => {
185+
expect(method).toBe("GET");
186+
expect(testUrl).toBe(url + "/maritimepcinfo");
187+
expect(options).not.toBeNull();
188+
return Promise.resolve(new Response(JSON.stringify(maritimepcinfo)));
189+
});
190+
service.getChartMaritimePcInfo((result) => {
191+
serviceResult = result;
192+
try {
193+
expect(service).not.toBeNull();
194+
expect(serviceResult).not.toBeNull();
195+
expect(serviceResult.type).toEqual("processCompleted");
196+
var result = serviceResult.result;
197+
expect(result).not.toBeNull();
198+
done();
199+
} catch (e) {
200+
console.log("'getChartMaritimePcInfo'案例失败" + e.name + ":" + e.message);
201+
expect(false).toBeTruthy();
202+
done();
203+
}
204+
});
205+
});
183206
it('_processFormat', (done) => {
184207
var service = new ChartService(url, {});
185208
expect(service._processFormat()).not.toBeFalsy();

test/maplibregl/services/ChartServiceSpec.js

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ describe('maplibregl_ChartService', () => {
119119
const service2Res = service2.getChartWaterDepth(parms);
120120
expect(service2Res).toBeNull();
121121
service.getChartWaterDepth(parms).then(res => {
122-
expect(res.result.value).toBe(12)
123-
expect(res.result.row).toBe(845)
124-
expect(res.result.column).toBe(385)
122+
expect(res.depth.result.value).toBe(12)
123+
expect(res.depth.result.row).toBe(845)
124+
expect(res.depth.result.column).toBe(385)
125125
done();
126126
})
127127
});
@@ -178,6 +178,30 @@ describe('maplibregl_ChartService', () => {
178178
done();
179179
})
180180
});
181+
it('getChartMaritimePcInfo', (done) => {
182+
var service = new ChartService(url, dataUrl, options);
183+
spyOn(FetchRequest, 'commit').and.callFake((method, testUrl, params, options) => {
184+
expect(method).toBe("GET");
185+
expect(testUrl).toBe(url + "/maritimepcinfo");
186+
expect(options).not.toBeNull();
187+
return Promise.resolve(new Response(JSON.stringify(maritimepcinfo)));
188+
});
189+
service.getChartMaritimePcInfo((result) => {
190+
serviceResult = result;
191+
try {
192+
expect(service).not.toBeNull();
193+
expect(serviceResult).not.toBeNull();
194+
expect(serviceResult.type).toEqual("processCompleted");
195+
var result = serviceResult.result;
196+
expect(result).not.toBeNull();
197+
done();
198+
} catch (e) {
199+
console.log("'getChartMaritimePcInfo'案例失败" + e.name + ":" + e.message);
200+
expect(false).toBeTruthy();
201+
done();
202+
}
203+
});
204+
});
181205
it('_processFormat', (done) => {
182206
var service = new ChartService(url, {});
183207
expect(service._processFormat()).not.toBeFalsy();

test/openlayers/services/ChartServiceSpec.js

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ describe('openlayers_ChartService', () => {
109109
if (testUrl.indexOf("/gridValue") > -1) {
110110
return Promise.resolve(new Response(JSON.stringify(gridValue)));
111111
}
112-
if (testUrl.indexOf("S102_102YYYY000000000002_Group01_D") > -1) {
112+
if (testUrl.indexOf("S102_102YYYY000000000002_Group01") > -1) {
113113
return Promise.resolve(new Response(JSON.stringify(datasetRes)));
114114
}
115115

@@ -119,9 +119,9 @@ describe('openlayers_ChartService', () => {
119119
const service2Res = service2.getChartWaterDepth(parms);
120120
expect(service2Res).toBeNull();
121121
service.getChartWaterDepth(parms).then(res => {
122-
expect(res.result.value).toBe(12)
123-
expect(res.result.row).toBe(845)
124-
expect(res.result.column).toBe(385)
122+
expect(res.depth.result.value).toBe(12)
123+
expect(res.depth.result.row).toBe(845)
124+
expect(res.depth.result.column).toBe(385)
125125
done();
126126
})
127127
});
@@ -178,6 +178,30 @@ describe('openlayers_ChartService', () => {
178178
done();
179179
})
180180
});
181+
it('getChartMaritimePcInfo', (done) => {
182+
var service = new ChartService(url, dataUrl, options);
183+
spyOn(FetchRequest, 'commit').and.callFake((method, testUrl, params, options) => {
184+
expect(method).toBe('GET');
185+
expect(testUrl).toBe(url + '/maritimepcinfo');
186+
expect(options).not.toBeNull();
187+
return Promise.resolve(new Response(JSON.stringify(maritimepcinfo)));
188+
});
189+
service.getChartMaritimePcInfo((result) => {
190+
serviceResult = result;
191+
try {
192+
expect(service).not.toBeNull();
193+
expect(serviceResult).not.toBeNull();
194+
expect(serviceResult.type).toEqual('processCompleted');
195+
var result = serviceResult.result;
196+
expect(result).not.toBeNull();
197+
done();
198+
} catch (e) {
199+
console.log("'getChartMaritimePcInfo'案例失败" + e.name + ':' + e.message);
200+
expect(false).toBeTruthy();
201+
done();
202+
}
203+
});
204+
});
181205
it('_processFormat', (done) => {
182206
var service = new ChartService(url, {});
183207
expect(service._processFormat()).not.toBeFalsy();

0 commit comments

Comments
 (0)