More
This commit is contained in:
parent
cd34ee693f
commit
05a1f316e1
58 changed files with 3113 additions and 1277 deletions
|
|
@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest';
|
|||
|
||||
import type { FeatureMeta } from '../types';
|
||||
import { apiUrl, assertOk, buildFilterString, isAbortError } from './api';
|
||||
import { createSchoolFilterKey } from './school-filter';
|
||||
|
||||
describe('api utilities', () => {
|
||||
it('builds API URLs from endpoint names, paths, and params', () => {
|
||||
|
|
@ -64,4 +65,20 @@ describe('api utilities', () => {
|
|||
)
|
||||
).toBe('Property type:Flat');
|
||||
});
|
||||
|
||||
it('deduplicates repeated synthetic school filters before backend routes', () => {
|
||||
const features: FeatureMeta[] = [
|
||||
{ name: 'Good+ primary schools within 2km', type: 'numeric', min: 0, max: 10 },
|
||||
];
|
||||
|
||||
expect(
|
||||
buildFilterString(
|
||||
{
|
||||
[createSchoolFilterKey('primary', 'good', 2, 1)]: [1, 10],
|
||||
[createSchoolFilterKey('primary', 'good', 2, 2)]: [2, 8],
|
||||
},
|
||||
features
|
||||
)
|
||||
).toBe('Good+ primary schools within 2km:2:8');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue