Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {AvValidator} from 'availity-reactstrap-validation';
const fn = AvValidator.pattern;
describe('Pattern Validation', () => {
it('should not require a value', () => {
expect(fn('')).to.be.true;
});
it('should return custom error message if provided when field is not valid', () => {
expect(fn('at3', undefined, {value: /^\d$/, errorMessage: 'Invalid!'})).to.equal('Invalid!');
});
it('should accept regex objects', () => {
expect(fn('3', undefined, {value: /^\d$/})).to.be.true;
expect(fn('a', undefined, {value: /^\d$/})).to.be.false;
});
it('should accept regex like strings', () => {