1 | import test from 'ava'
|
2 | import Chance from '../chance.js'
|
3 | import _ from 'lodash'
|
4 |
|
5 | const chance = new Chance()
|
6 |
|
7 | test('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 |
|