Skip to content

test: move simulateTraffic to scripts/ and add missing test cases#49

Merged
jorge07 merged 1 commit intojorge07:masterfrom
josecarlospeer-cloud:feat/test-improvements
Feb 22, 2026
Merged

test: move simulateTraffic to scripts/ and add missing test cases#49
jorge07 merged 1 commit intojorge07:masterfrom
josecarlospeer-cloud:feat/test-improvements

Conversation

@josecarlospeer-cloud
Copy link
Contributor

D2.3 — Move simulateTraffic out of tests/

Violation: tests/ should contain automated tests only. simulateTraffic.ts is a manual load test utility that hits a live server and has no describe/test blocks. Jest may attempt to discover it, and it misleads contributors.

Fix: Moved to scripts/simulate-traffic.ts with a doc comment explaining purpose and usage (npx ts-node scripts/simulate-traffic.ts).


D2.4 — Missing test cases

Transaction.test.ts

  • Creating with a negative price is rejected by the domain
  • Creating with an unknown currency is rejected by the domain

These tests verify that the domain's invariants hold at the aggregate factory boundary — not just at the VO level.

GetOne.test.ts

  • GetOne for a non-existent transaction throws NotFoundException
  • Added prom.register.clear() to beforeEach (was missing — caused a duplicate metric registration error when test suites run sequentially in the same process)

Tests

17/17 pass.

D2.3 + D2.4 from Phase 2 roadmap.

D2.3 — Move simulateTraffic.ts out of tests/
  Violation: tests/ directory should contain automated tests only.
  simulateTraffic.ts is a manual load test utility that hits a live
  server and has no describe/test blocks. Jest may attempt to discover
  it, and it misleads contributors about what constitutes a test.

  Fix: move to scripts/simulate-traffic.ts with a doc comment
  explaining its purpose and usage.

D2.4 — Add missing test coverage
  Transaction.test.ts:
  - Creating with negative price is rejected by the domain
  - Creating with unknown currency is rejected by the domain

  GetOne.test.ts:
  - GetOne a non-existent transaction throws NotFoundException
  - Add prom.register.clear() to beforeEach (missing, caused duplicate
    metric error when test suites run in the same process)

Tests: 17 suites pass (was 14 before this branch).
@jorge07 jorge07 merged commit 7752416 into jorge07:master Feb 22, 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.

2 participants