import { describe, expect, it } from 'vitest';
import { matchesCatalogQuery } from './search';
describe('catalog comparison search matching', () => {
it('matches names, slugs, and small typing mistakes', () => {
expect(
matchesCatalogQuery('sirius', ['Sirius', 'sirius'])
).toBe(true);
expect(
matchesCatalogQuery('siruis', ['Sirius', 'sirius'])
).toBe(true);
expect(
matchesCatalogQuery('galaxy', [
'Samsung Galaxy S26',
'samsung-galaxy-s26'
])
).toBe(true);
});
it('does not make very short searches fuzzy', () => {
expect(matchesCatalogQuery('bla', ['Blueberry'])).toBe(
false
);
});
});
Browse the implementation files for Smartwatches Comparison.