import { describe, it, expect } from 'vitest' import { fuzzy } from '../src/renderer/src/fuzzy' describe('fuzzy', () => { it('matches greedily from the left (first c, then a, then t)', () => { expect(fuzzy('cat', 'concatenate')).toEqual([0, 4, 5]) }) it('matches a non-contiguous subsequence', () => { expect(fuzzy('uc', 'UserController')).toEqual([0, 4]) }) it('is case-insensitive (skips the e to reach r)', () => { expect(fuzzy('USR', 'user')).toEqual([0, 1, 3]) }) it('returns null when not a subsequence', () => { expect(fuzzy('xyz', 'abc')).toBeNull() expect(fuzzy('ca', 'abc')).toBeNull() // order matters }) it('returns an empty index array for an empty query', () => { expect(fuzzy('', 'anything')).toEqual([]) }) })