Skip to content

Commit

Permalink
Adiciona testes de novos métodos do CNPJ
Browse files Browse the repository at this point in the history
  • Loading branch information
victorers1 committed Dec 16, 2024
1 parent 2c477f3 commit 5b844ed
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/util_brasil_fields_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,35 @@ void main() {
expect(UtilBrasilFields.obterCnpj(cpnjSemMascara), cpnjComMascara);
});

test('Obter inscrição CNPJ', () {
const cpnjSemMascara = '34318733000190';
const cpnjComMascara = '34.318.733/0001-90';
expect(UtilBrasilFields.obterInscricaoCnpj(cpnjSemMascara), '34318733');
expect(UtilBrasilFields.obterInscricaoCnpj(cpnjComMascara), '34318733');
expect(
UtilBrasilFields.obterInscricaoCnpj(cpnjSemMascara, useFormat: true),
'34.318.733',
);
expect(
UtilBrasilFields.obterInscricaoCnpj(cpnjComMascara, useFormat: true),
'34.318.733',
);
});

test('Obter Ordem do CNPJ', () {
const cpnjSemMascara = '34318733000190';
const cpnjComMascara = '34.318.733/0001-90';
expect(UtilBrasilFields.obterOrdemCnpj(cpnjSemMascara), '0001');
expect(UtilBrasilFields.obterOrdemCnpj(cpnjComMascara), '0001');
});

test('Obter dígitos verificadores do CNPJ', () {
const cpnjSemMascara = '34318733000190';
const cpnjComMascara = '34.318.733/0001-90';
expect(UtilBrasilFields.obterDivCnpj(cpnjSemMascara), '90');
expect(UtilBrasilFields.obterDivCnpj(cpnjComMascara), '90');
});

group('Obter Real', () {
test('com moeda (R\$)', () {
const real = 85437107.04;
Expand Down

0 comments on commit 5b844ed

Please sign in to comment.