All checks were successful
Deploy production / deploy (push) Successful in 2m33s
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
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');
|
|
});
|
|
});
|