• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

reactivando / validations-br / 17666370613
91%
master: 94%

Build:
Build:
LAST BUILD BRANCH: main
DEFAULT BRANCH: master
Ran 12 Sep 2025 06:21AM UTC
Jobs 1
Files 40
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

12 Sep 2025 06:21AM UTC coverage: 92.345% (-2.2%) from 94.588%
17666370613

push

github

web-flow
fix(validations): Correct validation logic and test data (#48)

* fix(validations): correct validation logic and test data

A recent refactor introduced several bugs in the validation functions and left the test suite with incorrect data. This commit addresses these issues across multiple validation modules.

- `validateCNPJ`: Re-implemented the validation logic to correctly use the standard algorithm with two sets of weights. The generic `mod11` function was not suitable. Corrected the test data to move an invalid CNPJ to the failing test case.
- `validatePIS`: Corrected the check digit calculation logic and updated the test data with algorithmically valid PIS numbers.
- `validateCNH`: Added a missing length check and corrected the DV2 calculation. Updated the test suite to move invalid CNHs to the failing test case.
- `validatePhone`: Updated the validation for 8-digit landlines to accept a wider range of valid starting digits (including 6 and 8).
- `validateIE`:
  - For Goiás (GO), added '20' to the list of valid IE prefixes.
  - For Tocantins (TO), rewrote the validation logic to correctly handle different formats based on length and embedded prefixes.
- Removed the `cpf-cnpj-validator` dependency that was added for debugging purposes.

All test suites now pass.

* chore: Fix linting errors

This commit addresses all the linting errors reported by the linter.
- Fixed Prettier formatting issues in several files.
- Replaced a `for...of` loop with `forEach` to comply with the configured rules.
- Addressed a `no-unused-vars` error in a type definition with an `eslint-disable` comment.

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>

182 of 216 branches covered (84.26%)

Branch coverage included in aggregate %.

55 of 61 new or added lines in 8 files covered. (90.16%)

20 existing lines in 14 files now uncovered.

578 of 607 relevant lines covered (95.22%)

12.64 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
3
81.82
-10.02% src/validations/ie/states/to.ts
3
81.08
-3.53% src/validations/validateCNH.ts

Uncovered Existing Lines

Lines Coverage ∆ File
1
90.0
1.11% src/validations/ie/states/al.ts
1
87.5
-0.5% src/validations/ie/states/am.ts
1
93.75
-3.81% src/validations/ie/states/ba.ts
1
94.29
-0.71% src/validations/ie/states/df.ts
1
92.86
-1.02% src/validations/ie/states/mg.ts
1
91.67
0.0% src/validations/ie/states/mt.ts
1
91.67
-1.44% src/validations/ie/states/pe.ts
1
92.86
-1.08% src/validations/ie/states/pr.ts
1
91.67
0.0% src/validations/ie/states/rj.ts
1
91.67
0.0% src/validations/ie/states/rs.ts
1
81.08
-3.53% src/validations/validateCNH.ts
2
83.78
-1.06% src/validations/ie/states/go.ts
2
84.0
-2.96% src/validations/ie/states/rn.ts
5
79.55
-18.13% src/validations/ie/states/ap.ts
Jobs
ID Job ID Ran Files Coverage
1 17666370613.1 12 Sep 2025 06:21AM UTC 40
92.35
GitHub Action Run
Source Files on build 17666370613
  • Tree
  • List 40
  • Changed 31
  • Source Changed 31
  • Coverage Changed 31
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #17666370613
  • d0028a8f on github
  • Prev Build on main (#17665807842)
  • Next Build on main (#17783612896)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc