renovate/test/util/regex.spec.ts
2019-08-25 14:29:51 +02:00

21 lines
422 B
TypeScript

import RE2 from 're2';
import { RegEx } from '../../lib/util/regex';
describe('util/regex', () => {
beforeEach(() => {
jest.resetModules();
});
it('uses RE2', () => {
expect(RegEx).toEqual(RE2);
});
it('Falls back to RegExp', () => {
jest.doMock('re2', () => {
throw new Error();
});
const regex = require('../../lib/util/regex');
expect(regex.RegEx).toEqual(RegExp);
});
});