validator-brazil
Version:
validacao de cpf e cnpj
24 lines (18 loc) • 699 B
JavaScript
const isCnpj = require("../index").isCnpj;
describe("cnpj validation", () => {
it("should return true to valid cnpj without hyphen and points", () => {
expect(isCnpj("00933180000164")).toBeTruthy();
});
it("should return true to valid cnpj with hyphen and points", () => {
expect(isCnpj("00.933.180/0001-64")).toBeTruthy();
});
it("should return false with letters", () => {
expect(isCnpj("00933180000164a")).toBeFalsy();
});
it("should return false to invalid cnpj with hyphen and points", () => {
expect(isCnpj("001112220000133")).toBeFalsy();
});
it("should return false to invalid cnpj", () => {
expect(isCnpj("00000000000000")).toBeFalsy();
});
});