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

This commit is contained in:
2026-10-24 15:40:20 +00:00
parent e95b7da1e3
commit 113eb54cd9
13 changed files with 19150 additions and 13 deletions

View 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');
});
});