From 3b1e71585470ec05ed8d54b37c95556d65db5a98 Mon Sep 17 00:00:00 2001 From: Kerry Date: Tue, 3 May 2022 10:29:43 +0200 Subject: [PATCH] Live location sharing: remove geoUri logs (#8465) * remove geoUri logs Signed-off-by: Kerry Archibald * Update src/components/views/location/Map.tsx Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/location/Map.tsx | 8 ++++---- test/components/views/location/Map-test.tsx | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/views/location/Map.tsx b/src/components/views/location/Map.tsx index b3e109f453..023ff2d5cc 100644 --- a/src/components/views/location/Map.tsx +++ b/src/components/views/location/Map.tsx @@ -51,8 +51,8 @@ const useMapWithStyle = ({ id, centerGeoUri, onError, interactive, bounds }) => try { const coords = parseGeoUri(centerGeoUri); map.setCenter({ lon: coords.longitude, lat: coords.latitude }); - } catch (error) { - logger.error('Could not set map center', centerGeoUri); + } catch (_error) { + logger.error('Could not set map center'); } } }, [map, centerGeoUri]); @@ -65,8 +65,8 @@ const useMapWithStyle = ({ id, centerGeoUri, onError, interactive, bounds }) => [bounds.east, bounds.north], ); map.fitBounds(lngLatBounds, { padding: 100, maxZoom: 15 }); - } catch (error) { - logger.error('Invalid map bounds', error); + } catch (_error) { + logger.error('Invalid map bounds'); } } }, [map, bounds]); diff --git a/test/components/views/location/Map-test.tsx b/test/components/views/location/Map-test.tsx index 72826a9cdf..12915c192e 100644 --- a/test/components/views/location/Map-test.tsx +++ b/test/components/views/location/Map-test.tsx @@ -101,7 +101,7 @@ describe('', () => { const logSpy = jest.spyOn(logger, 'error').mockImplementation(); getComponent({ centerGeoUri: '123 Sesame Street' }); expect(mockMap.setCenter).not.toHaveBeenCalled(); - expect(logSpy).toHaveBeenCalledWith('Could not set map center', '123 Sesame Street'); + expect(logSpy).toHaveBeenCalledWith('Could not set map center'); }); it('updates map center when centerGeoUri prop changes', () => { @@ -133,7 +133,7 @@ describe('', () => { const bounds = { north: 'a', south: 'b', east: 42, west: 41 }; getComponent({ bounds }); expect(mockMap.fitBounds).not.toHaveBeenCalled(); - expect(logSpy).toHaveBeenCalledWith('Invalid map bounds', new Error('Invalid LngLat object: (41, NaN)')); + expect(logSpy).toHaveBeenCalledWith('Invalid map bounds'); }); it('updates map bounds when bounds prop changes', () => {