Skip to content

test: add spec files for all 15 library modules (closes #7)#97

Merged
mariohmol merged 3 commits into
masterfrom
fix/js-brasil-2.7.1
Apr 15, 2026
Merged

test: add spec files for all 15 library modules (closes #7)#97
mariohmol merged 3 commits into
masterfrom
fix/js-brasil-2.7.1

Conversation

@mariohmol

Copy link
Copy Markdown
Owner

Summary

  • Creates co-located spec files for all 15 ng-brazil modules: cpf, cnpj, cep, rg, telefone, celular, inscricaoestadual, currency, number, percentage, pispasep, placa, renavam, time, titulo
  • Each spec covers validator (empty/valid/invalid), pipe (format output), and directive (existence) — 75 tests total, all passing
  • Fixes Angular 19 test infrastructure that was broken (0 tests running before)

What changed

New spec files (15): ng-brazil/src/<module>/<module>.spec.ts — one per module, co-located with source

Infrastructure fixes:

  • angular.json — remove deprecated main: src/test.ts; add include patterns for library spec discovery; use Angular 19 built-in test entry
  • karma.conf.js — replace removed karma-coverage-istanbul-reporter with karma-coverage; add zone.js + zone.js/testing as karma script files for correct load order (zone.js → jasmine → zone.js/testing)
  • src/tsconfig.spec.json — add ../ng-brazil/src/**/*.spec.ts to include so library specs are compiled
  • src/app/demo/demo.component.ts — remove fakerBr import (removed from js-brasil 2.7.1)

Test plan

  • npm run testdemo -- --watch=false --browsers=ChromeHeadless → 75 SUCCESS, 0 FAILED
  • All 15 modules covered: validator valid/invalid/empty, pipe format, directive existence
  • Existing app component tests continue to pass

🤖 Generated with Claude Code

mariohmol and others added 3 commits April 14, 2026 04:16
Create co-located spec files covering validator, pipe, and directive for
each module: cpf, cnpj, cep, rg, telefone, celular, inscricaoestadual,
currency, number, percentage, pispasep, placa, renavam, time, titulo.

Fix test infrastructure to run with Angular 19:
- Remove deprecated main:test.ts entry; use built-in Angular 19 discovery
- Add include patterns in angular.json for library spec files
- Load zone.js + zone.js/testing via karma files for correct order
- Replace removed karma-coverage-istanbul-reporter with karma-coverage
- Update tsconfig.spec.json to compile library specs
- Fix demo.component.ts: remove fakerBr (removed from js-brasil 2.7.1)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace static seed values in generate() with live generators that
produce valid CPF, CNPJ, CEP, RG, Telefone, Placa, Renavam, PIS/PASEP,
Título, Time, and Currency using inline check-digit algorithms.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Bump js-brasil to 2.8.0 which ships the new fakerBr module, then replace
the ~90 lines of inline check-digit generators in demo.component.ts with
direct calls to fakerBr.  The algorithm now lives in one tested place
(js-brasil) instead of being duplicated in the demo.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mariohmol mariohmol merged commit fc57329 into master Apr 15, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant