houses: Leefbaarometer liveability per listing (PDOK geocode + LBM 2024 grid/buurt), min-score filter and sort; store every regional listing (no price caps at scrape time)
All checks were successful
Deploy production / deploy (push) Successful in 2m33s
All checks were successful
Deploy production / deploy (push) Successful in 2m33s
This commit is contained in:
30
src/lib/house-tracker/liveability.test.ts
Normal file
30
src/lib/house-tracker/liveability.test.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { gridCellId, lbmClassLabel, lbmDimensionLabel, lbmQuery } from './liveability';
|
||||
|
||||
describe('leefbaarometer helpers', () => {
|
||||
it('names the 100 m cell by its lower-left corner in hectometres', () => {
|
||||
expect(gridCellId([106050.4, 446899.9])).toBe('E1060N4468');
|
||||
expect(gridCellId([105866.161, 446838.902])).toBe('E1058N4468');
|
||||
});
|
||||
it('labels classes 1-9', () => {
|
||||
expect(lbmClassLabel(1)).toBe('zeer onvoldoende');
|
||||
expect(lbmClassLabel(9)).toBe('uitstekend');
|
||||
expect(lbmClassLabel(0)).toBeNull();
|
||||
expect(lbmDimensionLabel(5)).toBe('geen afwijking');
|
||||
});
|
||||
it('builds the geocode query from street, postcode and city', () => {
|
||||
expect(lbmQuery({ street: 'Raam 12', postalCode: '2801 vk', city: 'Gouda' })).toBe(
|
||||
'Raam 12 | 2801VK | Gouda'
|
||||
);
|
||||
expect(lbmQuery({ street: null, postalCode: null, city: 'Gouda' })).toBeNull();
|
||||
expect(
|
||||
lbmQuery({
|
||||
street: null,
|
||||
postalCode: null,
|
||||
city: 'Gouda',
|
||||
title: 'Turfmarkt 5',
|
||||
source: 'manual'
|
||||
})
|
||||
).toBe('Turfmarkt 5 | Gouda');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user