search.test.js 818 B

12345678910111213
  1. import { createSearchRules } from '@/options/utils/search';
  2. test('createSearchRules', () => {
  3. expect(createSearchRules('')).toMatchSnapshot();
  4. expect(createSearchRules('#a #b !#c hello "CaseSensitive" CaseInsensitive')).toMatchSnapshot();
  5. expect(createSearchRules('#a-b #b name:hello world')).toMatchSnapshot();
  6. expect(createSearchRules('#a.b #b name:"hello world"')).toMatchSnapshot();
  7. expect(createSearchRules('#a.b #b name+re:"hello world"')).toMatchSnapshot();
  8. expect(createSearchRules('#a.b #b !name+re:"hello world"')).toMatchSnapshot();
  9. expect(createSearchRules('"#a.b" !"#b"')).toMatchSnapshot();
  10. expect(createSearchRules(String.raw`/\d+\D+/ code:/\d+\D+/u /not regexp/`)).toMatchSnapshot();
  11. expect(createSearchRules('foobar re:foobar name+re:foobar code+re:foobar')).toMatchSnapshot();
  12. });