Skip to content

test(indexer): cover compliance-status normalization, cent precision,… - #136

Merged
valoryyaa-byte merged 1 commit into
RWA-ToolKit:mainfrom
Valreb001:test/indexer-coverage
Jul 28, 2026
Merged

test(indexer): cover compliance-status normalization, cent precision,…#136
valoryyaa-byte merged 1 commit into
RWA-ToolKit:mainfrom
Valreb001:test/indexer-coverage

Conversation

@Valreb001

Copy link
Copy Markdown
Contributor

Closes #41
Closes #42
Closes #43
Closes #44

Summary

Added four test-coverage improvements to api/src/indexer/mod.rs — compliance status normalization (all four statuses, plain + array-wrapped), large cent-value precision limits for cents_to_usd, ratio_percent edge cases (0/0, part>whole, 2-decimal rounding), and a mock-RPC integration test proving index_compliance_and_holders sorts holders by balance descending. I also had to restore three lines a prior bad merge had silently dropped (Cargo metrics deps, two use imports, and AppState::last_indexed_ledger)

… ratio edges, and holder ordering

- Assert all four KYC statuses (Approved/Pending/Rejected/Suspended)
  normalize from both the plain-string and array-wrapped enum forms.
- Assert cents_to_usd behavior/precision at large i128 magnitudes,
  including the documented f64 precision limit past 2^53.
- Assert ratio_percent on 0/0, part > whole (clamped), and rounding
  to 2 decimal places.
- Add a mock-RPC integration test asserting
  index_compliance_and_holders orders holders by balance descending.

Also restores metrics/metrics-exporter-prometheus as Cargo
dependencies and two `use` imports (main.rs, indexer/mod.rs) plus
AppState::last_indexed_ledger, all of which were silently dropped by
the feat/api-hardening merge (59c9fdd) and left the crate not
compiling; the new tests need the crate to build to run at all.
@drips-wave

drips-wave Bot commented Jul 25, 2026

Copy link
Copy Markdown

@Valreb001 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@valoryyaa-byte
valoryyaa-byte merged commit 82c17bf into RWA-ToolKit:main Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants