1 parent
43347c1172
commit
6e15063502
122 files changed
+7848
-9828
No files matched your search
@@ -0,0 +1,9 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { createScenario } from '../adapters/fake/scenario';
|
||||
import { parseSmartQuery, replacementCandidates, smartSelect } from './selectors';
|
||||
describe('smart selectors', () => {
|
||||
const state = createScenario();
|
||||
it('translates the documented grammar into visible filters', () => expect(parseSmartQuery('Available ISR aircraft within 20 km with more than 60% energy')).toEqual({ capability: 'ISR', available: true, maxDistanceKm: 20, minEnergy: 60, task: 'none' }));
|
||||
it('reports filter distribution and rejection reasons', () => { const result = smartSelect(state, parseSmartQuery('Available ISR aircraft within 20 km with more than 60% energy')); expect(result.matches.length).toBeGreaterThan(0); expect(result.distribution[0]).toEqual({ label: 'Fleet', count: 50 }); expect(result.rejected.length + result.matches.length).toBe(50); });
|
||||
it('ranks deterministic replacement candidates', () => { const one = replacementCandidates(state); const two = replacementCandidates(createScenario()); expect(one.map(item => item.vehicle.id)).toEqual(two.map(item => item.vehicle.id)); expect(one).toHaveLength(3); });
|
||||
});
|
||||
Reference in new issue
Block a user