From 2c02056817d59bf28889b0d0e4d80a836cd7b203 Mon Sep 17 00:00:00 2001 From: Anne_LXM Date: Wed, 29 May 2024 11:55:32 +0800 Subject: [PATCH] Update map.test.js --- pages/API/map/map.test.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/pages/API/map/map.test.js b/pages/API/map/map.test.js index 727866f6..7e97c643 100644 --- a/pages/API/map/map.test.js +++ b/pages/API/map/map.test.js @@ -45,9 +45,19 @@ describe('web-map', () => { const {southwest,northeast} = regionRes; const southwestExp ={ latitude: 39.88334279187766, longitude: 116.31050146728515 } const northeastExp ={ latitude: 40.0149408585477, longitude: 116.56799353271484 } - expect(southwest.latitude).toBeCloseTo(southwestExp.latitude, 3); - expect(southwest.longitude).toBeCloseTo(southwestExp.longitude, 3); - expect(northeast.latitude).toBeCloseTo(northeastExp.latitude, 3); - expect(northeast.longitude).toBeCloseTo(northeastExp.longitude, 3); + // 在Safari中返回的经纬度 + // southwest: { latitude: 39.64483423532459, longitude: 115.88249286914063 }, + // northeast: { latitude: 40.17153735946949, longitude: 116.91246113085938 }, + if(!process.env.uniTestPlatformInfo.includes('Safari')){ + expect(southwest.latitude).toBeCloseTo(southwestExp.latitude, 3); + expect(southwest.longitude).toBeCloseTo(southwestExp.longitude, 3); + expect(northeast.latitude).toBeCloseTo(northeastExp.latitude, 3); + expect(northeast.longitude).toBeCloseTo(northeastExp.longitude, 3); + }else{ + expect(southwest.longitude).not.toBeFalsy(); + expect(southwest.latitude).not.toBeFalsy(); + expect(northeastExp.longitude).not.toBeFalsy(); + expect(northeastExp.latitude).not.toBeFalsy(); + } }); }); -- GitLab