From 1b45b82cd75a4cef4a99b531646f12fc60813941 Mon Sep 17 00:00:00 2001 From: Mohmn Date: Wed, 29 Jun 2022 01:12:25 +0530 Subject: [PATCH] fix: replaced unrelevant keys in unit tests --- src/components/FeaturedTreesSlider/test.cy.js | 16 ++++++++-------- src/models/utils.js | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/FeaturedTreesSlider/test.cy.js b/src/components/FeaturedTreesSlider/test.cy.js index a00ab9d05..5531156d5 100644 --- a/src/components/FeaturedTreesSlider/test.cy.js +++ b/src/components/FeaturedTreesSlider/test.cy.js @@ -7,42 +7,42 @@ describe('Featured Trees Slider', () => { const trees = [ { id: '115059', - photo_url: 'https://picsum.photos/id/10/208', + image_url: 'https://picsum.photos/id/10/208', species: 'Palm Tree', }, { id: '115059', - photo_url: 'https://picsum.photos/id/1037/208', + image_url: 'https://picsum.photos/id/1037/208', species: 'Palm Tree', }, { id: '115059', - photo_url: 'https://picsum.photos/id/106/208', + image_url: 'https://picsum.photos/id/106/208', species: 'Palm Tree', }, { id: '115059', - photo_url: 'https://picsum.photos/id/107/208', + image_url: 'https://picsum.photos/id/107/208', species: 'Palm Tree', }, { id: '115059', - photo_url: 'https://picsum.photos/id/108/208', + image_url: 'https://picsum.photos/id/108/208', species: 'Palm Tree', }, { id: '115059', - photo_url: 'https://picsum.photos/id/109/208', + image_url: 'https://picsum.photos/id/109/208', species: 'Palm Tree', }, { id: '115059', - photo_url: 'https://picsum.photos/id/111/208', + image_url: 'https://picsum.photos/id/111/208', species: 'Palm Tree', }, { id: '115059', - photo_url: 'https://picsum.photos/id/112/208', + image_url: 'https://picsum.photos/id/112/208', species: 'Palm Tree', }, ]; diff --git a/src/models/utils.js b/src/models/utils.js index 48d6e3e4c..a19ee7caf 100644 --- a/src/models/utils.js +++ b/src/models/utils.js @@ -99,20 +99,20 @@ const fixCountryNames = (countries) => return country; }); - // For places that display a small size of pictures, we should use our image API to load it. // https://dev-k8s.treetracker.org/images/img/:domain/:params/:image // E.g., // https://dev-k8s.treetracker.org/images/img/treetracker-dev-images.s3.eu-central-1.amazonaws.com/w=300,h=400,r=90/2020.05.19.15.41.53_37.421998333333335_-122.08400000000002_c36747a4-101f-43ff-9a91-45b3cb9bfd01_IMG_20200515_141055_7587706704717292658.jpg // Params are width (pixels), height (pixels) and rotation (degrees). const getThumbnailImageUrls = (imageUrl, width = 400, height = 400) => { + if (!imageUrl) return ''; const imageUrlArr = imageUrl.split('/'); const domain = imageUrlArr[imageUrlArr.length - 2]; const imagePath = imageUrlArr[imageUrlArr.length - 1]; const paramUrl = `w=${width},h=${height}`; const thumbNailImageUrl = `https://dev-k8s.treetracker.org/images/img/${domain}/${paramUrl}/${imagePath}`; return thumbNailImageUrl; - } +}; const debounce = (func, timeout = 50) => { let debouncedFunc = null;