LGTM
This commit is contained in:
parent
9248e26af2
commit
f2a2651b8a
95 changed files with 3993 additions and 1471 deletions
|
|
@ -4,6 +4,7 @@ import type { FeatureMeta } from '../types';
|
|||
import { apiUrl, assertOk, buildFilterString, isAbortError } from './api';
|
||||
import { createSchoolFilterKey } from './school-filter';
|
||||
import { createSpecificCrimeFilterKey } from './crime-filter';
|
||||
import { createElectionVoteShareFilterKey } from './election-filter';
|
||||
import { createEthnicityFilterKey } from './ethnicity-filter';
|
||||
import {
|
||||
POI_COUNT_2KM_FILTER_NAME,
|
||||
|
|
@ -106,6 +107,23 @@ describe('api utilities', () => {
|
|||
).toBe('Burglary (avg/yr):0:5;;Vehicle crime (avg/yr):1:10');
|
||||
});
|
||||
|
||||
it('serializes election vote-share filters using their selected backend party feature', () => {
|
||||
const features: FeatureMeta[] = [
|
||||
{ name: '% Labour', type: 'numeric', min: 0, max: 100 },
|
||||
{ name: '% Conservative', type: 'numeric', min: 0, max: 100 },
|
||||
];
|
||||
|
||||
expect(
|
||||
buildFilterString(
|
||||
{
|
||||
[createElectionVoteShareFilterKey('% Labour', 1)]: [30, 60],
|
||||
[createElectionVoteShareFilterKey('% Conservative', 2)]: [10, 40],
|
||||
},
|
||||
features
|
||||
)
|
||||
).toBe('% Labour:30:60;;% Conservative:10:40');
|
||||
});
|
||||
|
||||
it('deduplicates repeated ethnicity filters to the strictest backend range', () => {
|
||||
const features: FeatureMeta[] = [{ name: '% White', type: 'numeric', min: 0, max: 100 }];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue