1import { createSelectionFilter } from '../prompts'; 2 3describe(createSelectionFilter, () => { 4 it(`searches values`, async () => { 5 const filter = createSelectionFilter(); 6 const choices = [{ title: 'bacon' }, { title: `\\hey` }]; 7 8 for (const [search, result] of [ 9 [`\\`, `\\hey`], 10 [`on`, `bacon`], 11 ]) { 12 expect(await filter(search, choices)).toEqual([{ title: result }]); 13 } 14 // escaped 15 expect(await filter('\\\n\t\r', choices)).toEqual([]); 16 }); 17}); 18