From 31109c4698b3bf0368d139b3edacd2235bc30853 Mon Sep 17 00:00:00 2001 From: Yash Srivastava <52625656+darkshredder@users.noreply.github.com> Date: Mon, 10 May 2021 00:27:26 +0530 Subject: [PATCH] feat: Removed polygon parameter from API and debug link (#145) --- src/components/LastUpdated.svelte | 6 ++++++ test/search.js | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/src/components/LastUpdated.svelte b/src/components/LastUpdated.svelte index 44738f2..f03e8cd 100644 --- a/src/components/LastUpdated.svelte +++ b/src/components/LastUpdated.svelte @@ -11,6 +11,12 @@ last_api_request_url_store.subscribe(url => { last_api_request_url = url; + if (last_api_request_url) { + last_api_request_url = new URL(last_api_request_url); + last_api_request_url.searchParams.delete('polygon_geojson'); + last_api_request_url = last_api_request_url.toString(); + } + if (fetch_running || last_updated_date) return; fetch_running = true; diff --git a/test/search.js b/test/search.js index 6827392..0e6ec9f 100644 --- a/test/search.js +++ b/test/search.js @@ -94,6 +94,15 @@ describe('Search Page', function () { assert.deepEqual(link_titles, ['API request', 'debug output']); }); + it('should not have polygon params in API request and debug URL', async function () { + let links_href = await page.$$eval('#api-request a', links => links.map(l => l.href)); + let api_request_url = new URL(links_href[0]); + let debug_url = new URL(links_href[1]); + + assert.deepStrictEqual(api_request_url.searchParams.has('polygon_geojson'), false); + assert.deepStrictEqual(debug_url.searchParams.has('polygon_geojson'), false); + }); + it('should display a map', async function () { await page.waitForSelector('#map'); assert.equal((await page.$$('#map')).length, 1); -- 2.39.5