UNPKG

395 BJavaScriptView Raw
1import test from 'ava'
2import Chance from '../chance.js'
3import _ from 'lodash'
4
5const chance = new Chance()
6
7test('cnpj() returns a random valid taxpayer number for Brazil companies (CNPJ)', t => {
8 _.times(1000, () => {
9 let cnpj = chance.cnpj()
10 t.true(_.isString(cnpj))
11 t.true(/^\d{2}.\d{3}.\d{3}\/\d{4}-\d{2}$/m.test(cnpj))
12 t.is(cnpj.length, 18)
13 })
14})
15