Skip to content

test(platform): improve platform-value test coverage#3313

Merged
QuantumExplorer merged 1 commit into
v3.1-devfrom
test/platform-value-coverage
Mar 15, 2026
Merged

test(platform): improve platform-value test coverage#3313
QuantumExplorer merged 1 commit into
v3.1-devfrom
test/platform-value-coverage

Conversation

@QuantumExplorer

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

Improve test coverage for the platform-value crate (previously at ~39.8%).

What was done?

Added 270 new integration tests in packages/rs-platform-value/tests/coverage_tests.rs targeting previously uncovered code paths across the platform-value crate:

  • Value type system (lib.rs): is_integer, is_integer_can_fit_in_64_bits, as_integer, into_integer, to_integer, to_integer_broad_conversion (float/bool/text coercion), has_data_larger_than for all 20+ variant types
  • From/TryFrom impls (lib.rs): Option<Value>, char, &String, Vec<&str>, &[&str], BTreeMap variants, fixed-size array map constructors, TryFrom<Value> for String/Vec<u8>/integer types
  • Bytes conversions (lib.rs): into_bytes/to_bytes/to_binary_data/as_bytes_slice from Bytes20/32/36/Identifier/Array
  • Accessor methods (lib.rs): All float/text/bool/null/array/map getters, mutators, and error paths
  • Display (display.rs): All variant formatting including long text truncation, non_qualified_string_representation
  • Equality (eq.rs): PartialEq for all integer widths, String, &str, f64, Vec, byte arrays (both owned and ref), equal_underlying_data cross-variant
  • String encoding (string_encoding.rs): Encode/decode roundtrips for Base58/Base64/Hex, error paths, Display
  • ValueMap (value_map.rs): All 15 ValueMapHelper trait methods including sort variants, get/insert/remove operations
  • Inner value ops (inner_value.rs): Map get/set/remove operations, typed getters (integer/str/bool/array/bytes), insert sorted, push to map
  • Path operations (inner_value_at_path.rs): get/set/remove at dot-notation paths including array index syntax
  • Index (index.rs): [] operator for map/array/non-container types, IndexMut, null-to-map promotion
  • Pointer (pointer.rs): RFC 6901 navigation, escape sequences, take(), edge cases
  • Patch (patch/): Add/remove/replace/move/copy/test operations, array operations, root replacement, merge patch (RFC 7396), diff
  • JSON converter (converter/serde_json.rs): TryInto/From for all types, validating JSON conversions, U128/I128 overflow, BTreeValueJsonConverter trait
  • CBOR converter (converter/ciborium.rs): TryInto/TryFrom for all types, tag error, buffer serialization, Box conversion
  • Serde roundtrip (value_serialization/): to_value/from_value for primitives, Option, complex structs
  • Replace (replace.rs): Integer type replacement at paths, clean_recursive
  • System bytes (system_bytes.rs): Identifier/binary data conversions from various sources
  • BTreeMap extensions: BTreeValueMapHelper (20+ methods), EqualUnderlyingData, BTreeValueMapPathHelper, BTreeValueRemoveFromMapHelper, BTreeMutValueMapHelper

How Has This Been Tested?

  • cargo test -p platform-value --all-features -- all 364 tests pass (94 existing + 270 new)
  • cargo fmt --package platform-value -- code is properly formatted
  • All existing tests continue to pass with no regressions

Breaking Changes

None. This PR only adds tests.

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

Add 270 new integration tests targeting previously uncovered code paths
across the platform-value crate. Tests cover:

- Value type checks, integer conversions, broad coercion (lib.rs)
- has_data_larger_than for all variant types
- From/TryFrom implementations for various Rust types
- Bytes conversions (Bytes20/32/36, Identifier, Array)
- Float/text/bool/null/array/map accessor methods and error paths
- Display formatting for all Value variants
- PartialEq implementations (integers, strings, floats, bytes, refs)
- equal_underlying_data cross-variant comparison
- String encoding/decoding (Base58, Base64, Hex)
- ValueMap trait methods (sort, get, insert, remove)
- Inner value map operations (get/set/remove typed values)
- Path-based value access and mutation
- Index/IndexMut operator overloads
- Pointer (RFC 6901) navigation and mutation
- Patch operations (add, remove, replace, move, copy, test)
- Merge patch (RFC 7396)
- Diff generation
- JSON converter (TryInto, From, validating conversions)
- CBOR converter (TryInto, TryFrom, buffer serialization)
- Serde roundtrip (to_value/from_value for various types)
- Replace operations (integer type replacement, clean_recursive)
- System bytes conversions (identifier, binary data, hash256)
- BTreeMap extension helpers (all getter/removal methods)
- Inner array push operation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Mar 15, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@QuantumExplorer has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 56 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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e4114567-908a-442f-8dda-0d6902a6c0ca

📥 Commits

Reviewing files that changed from the base of the PR and between edf29c8 and 928673c.

📒 Files selected for processing (1)
  • packages/rs-platform-value/tests/coverage_tests.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/platform-value-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 github-actions Bot added this to the v3.1.0 milestone Mar 15, 2026
@QuantumExplorer QuantumExplorer changed the title test(platform-value): improve test coverage test(platform): improve platform-value test coverage Mar 15, 2026
@QuantumExplorer QuantumExplorer merged commit 40dcce0 into v3.1-dev Mar 15, 2026
34 of 35 checks passed
@QuantumExplorer QuantumExplorer deleted the test/platform-value-coverage branch March 15, 2026 16:22
@codecov

codecov Bot commented Mar 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.57%. Comparing base (755cbe2) to head (928673c).
⚠️ Report is 17 commits behind head on v3.1-dev.

Additional details and impacted files
@@             Coverage Diff              @@
##           v3.1-dev    #3313      +/-   ##
============================================
+ Coverage     70.72%   71.57%   +0.84%     
============================================
  Files          3293     3293              
  Lines        265144   266000     +856     
============================================
+ Hits         187514   190378    +2864     
+ Misses        77630    75622    -2008     
Components Coverage Δ
dpp 60.13% <ø> (+1.06%) ⬆️
drive 78.29% <ø> (+0.11%) ⬆️
drive-abci 83.49% <ø> (+0.17%) ⬆️
sdk 31.25% <ø> (ø)
dapi-client 39.08% <ø> (ø)
platform-version ∅ <ø> (∅)
platform-value 58.46% <ø> (+19.10%) ⬆️
platform-wallet 60.40% <ø> (ø)
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.

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