kbn.test.ts 401 B

123456789101112131415
  1. import kbn from '../utils/kbn';
  2. describe('stringToJsRegex', () => {
  3. it('should parse the valid regex value', () => {
  4. const output = kbn.stringToJsRegex('/validRegexp/');
  5. expect(output).toBeInstanceOf(RegExp);
  6. });
  7. it('should throw error on invalid regex value', () => {
  8. const input = '/etc/hostname';
  9. expect(() => {
  10. kbn.stringToJsRegex(input);
  11. }).toThrow();
  12. });
  13. });