mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-28 08:49:38 +02:00
Initial open-source release
This commit is contained in:
commit
1a42152e6f
1199 changed files with 257054 additions and 0 deletions
26
packages/context/src/search/query.test.ts
Normal file
26
packages/context/src/search/query.test.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { describe, expect, it } from 'vitest';
|
||||
import { defaultLaneCandidatePoolLimit, normalizeSearchQuery } from './query.js';
|
||||
|
||||
describe('search query helpers', () => {
|
||||
it('normalizes punctuation and duplicate terms into stable lowercase tokens', () => {
|
||||
expect(normalizeSearchQuery(' Gross-Revenue, gross_revenue! Paid orders ')).toEqual({
|
||||
raw: ' Gross-Revenue, gross_revenue! Paid orders ',
|
||||
normalized: 'gross revenue gross_revenue paid orders',
|
||||
terms: ['gross', 'revenue', 'gross_revenue', 'paid', 'orders'],
|
||||
});
|
||||
});
|
||||
|
||||
it('returns an empty normalized query for punctuation-only input', () => {
|
||||
expect(normalizeSearchQuery('--- ///')).toEqual({
|
||||
raw: '--- ///',
|
||||
normalized: '',
|
||||
terms: [],
|
||||
});
|
||||
});
|
||||
|
||||
it('sizes per-lane candidate pools before final limiting', () => {
|
||||
expect(defaultLaneCandidatePoolLimit(1)).toBe(25);
|
||||
expect(defaultLaneCandidatePoolLimit(8)).toBe(25);
|
||||
expect(defaultLaneCandidatePoolLimit(10)).toBe(30);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue