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';
import {inputTypeOverride} from 'availity-reactstrap-validation/AvValidator/utils';
const fn = AvValidator.date;
const input = {props: {type: 'text'}};
const context = {};
describe('Date Validation', () => {
it('should not require a value', () => {
expect(fn('', context, undefined, input)).to.be.true;
});
describe('error message', () => {
it('should allow the error message to be overridden', () => {
expect(fn('abc 123', context, {errorMessage: 'Custom'}, input)).to.equal('Custom');
});
it('should use the custom format in the default message', () => {
expect(fn('abc 123', context, {format: 'YYYY-MM-DD'}, input)).to.equal('Format needs to be YYYY-MM-DD');
});