diff --git a/pages/API/get-location/get-location.test.js b/pages/API/get-location/get-location.test.js index 73bf95abf3b46dd8eb2e399cc3186de00d9b987e..c75d37dd3ca368e1337845ab81cbfc3f859534d6 100644 --- a/pages/API/get-location/get-location.test.js +++ b/pages/API/get-location/get-location.test.js @@ -39,7 +39,7 @@ describe("get-location", () => { expect((await page.data())['jest_latitude']).toBeLessThanOrEqual(90); //判断海拔是否正确 expect((await page.data())['jest_altitude']).toEqual(expect.any(Number)); - expect((await page.data())['jest_altitude']).not.toEqual('0'); + expect((await page.data())['jest_altitude']).not.toEqual(0); } }); @@ -94,7 +94,7 @@ describe("get-location", () => { //如果定位出错 expect((await page.data())['jest_errCode']).toEqual(expect.any(Number)); } else { - expect((await page.data())['jest_altitude']).toEqual('0'); + expect((await page.data())['jest_altitude']).toEqual(0); } }); @@ -146,7 +146,7 @@ describe("get-location", () => { expect((await page.data())['jest_latitude']).toBeLessThanOrEqual(90); //判断海拔是否正确 expect((await page.data())['jest_altitude']).toEqual(expect.any(Number)); - expect((await page.data())['jest_altitude']).not.toEqual('0'); + expect((await page.data())['jest_altitude']).not.toEqual(0); } }); diff --git a/pages/API/get-location/get-location.uvue b/pages/API/get-location/get-location.uvue index e1891a241777aa26cc471196b6eeec50dcb3abc7..a4742b53b0b83be7fd8898632a59a173ad40f222 100644 --- a/pages/API/get-location/get-location.uvue +++ b/pages/API/get-location/get-location.uvue @@ -80,17 +80,17 @@ providerList: [] as LocationItem[], current: 0, currentProvider: 0, - jest_provider: String, - jest_type: String, - jest_isAltitude: Boolean, - jest_isGeocode: Boolean, - jest_isHighAccuracy: Boolean, - jest_altitude: Number, - jest_longitude: Number, - jest_latitude: Number, - jest_address: String, - jest_errCode: Number, - jest_complete: Boolean + jest_provider: '', + jest_type: '', + jest_isAltitude: false, + jest_isGeocode: false, + jest_isHighAccuracy: false, + jest_altitude: 0, + jest_longitude: 0, + jest_latitude: 0, + jest_address: '', + jest_errCode: 0, + jest_complete: false } }, onLoad: function () {