Skip to content
Snippets Groups Projects
Select Git revision
  • 9bef259b010ed747bc3352dd2aaad8cdf66d4444
  • master default protected
  • dwmcallister-patch-1
  • 520-fix-wsl
  • tune-worker-processes
  • alpine-nginxorg
  • 1.29.0
  • 1.28.0
  • 1.27.5
  • 1.27.3
  • 1.27.2
  • 1.27.0
  • 1.26.1
  • 1.26.0
  • 1.25.5
  • 1.25.4
  • 1.25.3
  • 1.25.2
  • 1.25.1
  • 1.25.0
  • 1.24.0
  • 1.23.3
  • 1.23.4
  • 1.23.2
  • 1.22.1
  • 1.23.1
26 results

generate-stackbrew-library.sh

Blame
  • regex.spec.ts 587 B
    import RE2 from 're2';
    import { CONFIG_VALIDATION } from '../constants/error-messages';
    import { regEx } from './regex';
    
    describe('util/regex', () => {
      beforeEach(() => {
        jest.resetModules();
      });
    
      it('uses RE2', () => {
        expect(regEx('foo')).toBeInstanceOf(RE2);
      });
    
      it('throws unsafe 2', () => {
        expect(() => regEx(`x++`)).toThrow(CONFIG_VALIDATION);
      });
    
      it('Falls back to RegExp', () => {
        jest.doMock('re2', () => {
          throw new Error();
        });
    
        const regex = require('./regex');
        expect(regex.regEx('foo')).toBeInstanceOf(RegExp);
      });
    });