How to use the availity-reactstrap-validation.AvValidator.npi function in availity-reactstrap-validation

To help you get started, we’ve selected a few availity-reactstrap-validation examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Availity / availity-reactstrap-validation / __test__ / AvValidator.npi.spec.js View on Github external
import {AvValidator} from 'availity-reactstrap-validation';

const fn = AvValidator.npi;

describe('NPI 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('1234', undefined, {errorMessage: 'Not an NPI!'})).to.equal('Not an NPI!');
  });

  it('should return false if NPI contains non-digits', () => {
    expect(fn('i2eh56789o')).to.be.false;
  });

  it('should return false if NPI is not 10 digits in length', () => {
    expect(fn('123456789')).to.be.false;