From 46e43f4bde4a35785b4997b81e86cd19f046b69b Mon Sep 17 00:00:00 2001 From: Minteck Date: Tue, 21 Dec 2021 16:52:28 +0100 Subject: Commit --- src/node_modules/chance/test/test.company.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/node_modules/chance/test/test.company.js (limited to 'src/node_modules/chance/test/test.company.js') diff --git a/src/node_modules/chance/test/test.company.js b/src/node_modules/chance/test/test.company.js new file mode 100644 index 0000000..ab88a5f --- /dev/null +++ b/src/node_modules/chance/test/test.company.js @@ -0,0 +1,15 @@ +import test from 'ava' +import Chance from '../chance.js' +import _ from 'lodash' + +const chance = new Chance() + +test('cnpj() returns a random valid taxpayer number for Brazil companies (CNPJ)', t => { + _.times(1000, () => { + let cnpj = chance.cnpj() + t.true(_.isString(cnpj)) + t.true(/^\d{2}.\d{3}.\d{3}\/\d{4}-\d{2}$/m.test(cnpj)) + t.is(cnpj.length, 18) + }) +}) + -- cgit