diff --git a/frontend/src/components/map/LocationSearch.test.tsx b/frontend/src/components/map/LocationSearch.test.tsx index 5a66b7b..7bea049 100644 --- a/frontend/src/components/map/LocationSearch.test.tsx +++ b/frontend/src/components/map/LocationSearch.test.tsx @@ -397,7 +397,7 @@ describe('LocationSearch', () => { }); }); - it('keeps only the three most recent local searches', async () => { + it('keeps only the ten most recent local searches', async () => { vi.stubGlobal( 'fetch', vi.fn((input: string | URL | Request) => { @@ -416,8 +416,22 @@ describe('LocationSearch', () => { render(); + // Search eleven distinct postcodes; only the ten most recent should be kept. + const postcodes = [ + 'SW1A 1AA', + 'E14 2DG', + 'W1A 1AA', + 'EC1A 1BB', + 'N1 1AA', + 'M1 1AE', + 'B33 8TH', + 'CR2 6XH', + 'DN55 1PT', + 'L1 8JQ', + 'G1 1AA', + ]; const input = screen.getByRole('textbox'); - for (const postcode of ['SW1A 1AA', 'E14 2DG', 'W1A 1AA', 'EC1A 1BB']) { + for (const postcode of postcodes) { fireEvent.change(input, { target: { value: postcode } }); fireEvent.keyDown(input, { key: 'Enter' }); @@ -432,13 +446,13 @@ describe('LocationSearch', () => { const stored = JSON.parse(window.localStorage.getItem(RECENT_SEARCHES_STORAGE_KEY) ?? '[]') as { label?: string; }[]; - expect(stored.map((search) => search.label)).toEqual(['EC1A 1BB', 'W1A 1AA', 'E14 2DG']); + // Most recent first, oldest ('SW1A 1AA') dropped past the limit of ten. + expect(stored.map((search) => search.label)).toEqual([...postcodes].reverse().slice(0, 10)); fireEvent.focus(input); await waitFor(() => { - expect(screen.getByRole('button', { name: 'EC1A 1BB' })).toBeTruthy(); - expect(screen.getByRole('button', { name: 'W1A 1AA' })).toBeTruthy(); + expect(screen.getByRole('button', { name: 'G1 1AA' })).toBeTruthy(); expect(screen.getByRole('button', { name: 'E14 2DG' })).toBeTruthy(); }); expect(screen.queryByText('SW1A 1AA')).toBeNull(); diff --git a/server-rs/src/routes/actual_listings.rs b/server-rs/src/routes/actual_listings.rs index 4bd3629..645abcc 100644 --- a/server-rs/src/routes/actual_listings.rs +++ b/server-rs/src/routes/actual_listings.rs @@ -45,6 +45,10 @@ const KEEP_UNKNOWN_LISTING_FILTER_FEATURES: &[&str] = &[ "Leasehold/Freehold", "Number of bedrooms & living rooms", "Property type", + "Construction year", + "Interior height (m)", + "Current energy rating", + "Potential energy rating" ]; const LISTING_BOUNDS_EPSILON_DEGREES: f64 = 0.00001;