Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

test(drive-abci): add comprehensive tests for token query v0 modules#3265

Merged
QuantumExplorer merged 1 commit intov3.1-devfrom
test/drive-abci-token-queries-coverage
Mar 15, 2026
Merged

test(drive-abci): add comprehensive tests for token query v0 modules#3265
QuantumExplorer merged 1 commit intov3.1-devfrom
test/drive-abci-token-queries-coverage

Conversation

Copy link
Member

QuantumExplorer commented Mar 14, 2026

Issue being fixed or feature implemented

Add unit test coverage for all 10 token query v0 modules in packages/rs-drive-abci/src/query/token_queries/, which previously had 0% coverage.

What was done?

Added 71 comprehensive unit tests across all 10 token query v0/mod.rs files:

Module Tests Coverage Areas
identities_token_balances 6 invalid token_id, invalid identity_id, empty state, proof, data, data+proof
identities_token_infos 7 invalid token_id, invalid identity_id, empty state, proof, not_frozen, frozen, data+proof
identity_token_balances 6 invalid identity_id, invalid token_id, empty state, proof, data, data+proof
identity_token_infos 6 invalid identity_id, invalid token_id, empty state, proof, data, data+proof
token_contract_info 6 invalid token_id, not_found, proof, data pos0, data pos1, data+proof
token_direct_purchase_prices 9 empty ids, invalid token_id, empty state, proof, fixed price, variable price, no price, multiple tokens, data+proof
token_perpetual_distribution_last_claim 8 invalid token_id, invalid identity_id, proof, raw without contract, with contract info, invalid contract_id, contract not found, position too large, data+proof
token_pre_programmed_distributions 9 invalid token_id, empty state, proof, data, limit, start_at, invalid start_recipient, no distributions, data+proof
token_status 7 invalid token_id, empty state, proof, not paused, paused, multiple tokens, data+proof
token_total_supply 7 invalid token_id, not found, proof, data token0, data token1, data+proof

Also added a reusable setup_platform_with_token_state() helper function to query::tests that creates:

  • 3 test identities with keys and credits
  • A data contract with 3 tokens (including groups, perpetual distributions, and pre-programmed distributions)
  • Minted token balances across identities
  • Frozen identity state (identity 2 on token 0)
  • Paused token state (token 1)
  • Direct purchase pricing (fixed for token 1, variable schedule for token 2)

How Has This Been Tested?

All 71 tests pass:

cargo test -p drive-abci -- query::token_queries
test result: ok. 71 passed; 0 failed; 0 ignored; 0 measured; 1313 filtered out

Each test exercises both the validation error paths and the successful query paths (with and without proofs), targeting >93% line coverage for each v0/mod.rs file.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

...odules

Add 71 unit tests covering all code paths in the token_queries
v0/mod.rs files, bringing coverage from 0% to >93% for each module.

Modules covered:
- identities_token_balances (6 tests)
- identities_token_infos (7 tests)
- identity_token_balances (6 tests)
- identity_token_infos (6 tests)
- token_contract_info (6 tests)
- token_direct_purchase_prices (9 tests)
- token_perpetual_distribution_last_claim (8 tests)
- token_pre_programmed_distributions (9 tests)
- token_status (7 tests)
- token_total_supply (7 tests)

Each module tests: invalid identifier validation, empty state queries,
proof-based queries, and data queries with actual token state (contracts,
balances, freeze status, paused status, pricing, distributions).

Also adds setup_platform_with_token_state() helper to query::tests module
for reusable token state setup across all test modules.

Co-Authored-By: Claude Opus 4.6 (1M context)
Copy link
Contributor

coderabbitai bot commented Mar 14, 2026

Warning

Rate limit exceeded

@QuantumExplorer has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 8 minutes and 23 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

i Review info
Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c8f56aa9-0b1a-452d-999f-2db177cef226

Commits

Reviewing files that changed from the base of the PR and between ea02a14 and 6aee6d6.

Files selected for processing (11)
  • packages/rs-drive-abci/src/query/mod.rs
  • packages/rs-drive-abci/src/query/token_queries/identities_token_balances/v0/mod.rs
  • packages/rs-drive-abci/src/query/token_queries/identities_token_infos/v0/mod.rs
  • packages/rs-drive-abci/src/query/token_queries/identity_token_balances/v0/mod.rs
  • packages/rs-drive-abci/src/query/token_queries/identity_token_infos/v0/mod.rs
  • packages/rs-drive-abci/src/query/token_queries/token_contract_info/v0/mod.rs
  • packages/rs-drive-abci/src/query/token_queries/token_direct_purchase_prices/v0/mod.rs
  • packages/rs-drive-abci/src/query/token_queries/token_perpetual_distribution_last_claim/v0/mod.rs
  • packages/rs-drive-abci/src/query/token_queries/token_pre_programmed_distributions/v0/mod.rs
  • packages/rs-drive-abci/src/query/token_queries/token_status/v0/mod.rs
  • packages/rs-drive-abci/src/query/token_queries/token_total_supply/v0/mod.rs
Finishing Touches
Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test/drive-abci-token-queries-coverage
Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Comment @coderabbitai help to get the list of available commands and usage tips.

github-actions bot added this to the v3.1.0 milestone Mar 14, 2026
Copy link

codecov bot commented Mar 14, 2026 *
edited
Loading

Codecov Report

Patch coverage is 97.94566% with 31 lines in your changes missing coverage. Please review.
Project coverage is 66.63%. Comparing base (6c61849) to head (6aee6d6).
Report is 2 commits behind head on v3.1-dev.

Files with missing lines Patch % Lines
...ken_queries/token_direct_purchase_prices/v0/mod.rs 95.17% 7 Missing
...eries/token_pre_programmed_distributions/v0/mod.rs 97.04% 5 Missing
...bci/src/query/token_queries/token_status/v0/mod.rs 96.55% 4 Missing
...ery/token_queries/identities_token_infos/v0/mod.rs 97.39% 3 Missing
.../token_queries/identities_token_balances/v0/mod.rs 98.01% 2 Missing
...ry/token_queries/identity_token_balances/v0/mod.rs 98.03% 2 Missing
...query/token_queries/identity_token_infos/v0/mod.rs 97.97% 2 Missing
.../query/token_queries/token_contract_info/v0/mod.rs 97.72% 2 Missing
.../token_perpetual_distribution_last_claim/v0/mod.rs 98.79% 2 Missing
...c/query/token_queries/token_total_supply/v0/mod.rs 97.70% 2 Missing
Additional details and impacted files
@@ Coverage Diff @@
## v3.1-dev #3265 +/- ##
============================================
+ Coverage 66.08% 66.63% +0.55%
============================================
Files 3292 3292
Lines 253958 255467 +1509
============================================
+ Hits 167837 170240 +2403
+ Misses 86121 85227 -894
Components Coverage D
dpp 56.43% (+0.04%)
drive 73.79% (+0.25%)
drive-abci 77.98% <97.94%> (+1.45%)
sdk 30.34% (o)
dapi-client 39.08% (o)
platform-version ()
platform-value 39.35% (o)
platform-wallet 60.40% (o)
drive-proof-verifier ()
New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member Author

QuantumExplorer commented Mar 15, 2026

Self reviewed

QuantumExplorer merged commit b661752 into v3.1-dev Mar 15, 2026
24 checks passed
QuantumExplorer deleted the test/drive-abci-token-queries-coverage branch March 15, 2026 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

v3.1.0

Development

Successfully merging this pull request may close these issues.

1 participant