Skip to content

test: add unit test for argument table with empty inputs (Closes #424) - #429

Merged
codeZe-us merged 1 commit into
Toolbox-Lab:mainfrom
divysam:feat/add-empty-args-table-test
Aug 27, 2026
Merged

test: add unit test for argument table with empty inputs (Closes #424)#429
codeZe-us merged 1 commit into
Toolbox-Lab:mainfrom
divysam:feat/add-empty-args-table-test

Conversation

@divysam

@divysam divysam commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a unit test for render_context_table covering the empty-arguments edge case.

When TransactionContext.arguments is empty, the function returns an empty string via an early-return branch. This branch was previously untested, so this PR closes that gap.

What Changed

File Change
crates/cli/src/output/renderers.rs Added render_context_table_with_empty_arguments test

Test Details

The new test constructs a TransactionContext with arguments: vec![] and asserts that render_context_table returns an empty string (output.is_empty()). This mirrors the structure of the existing render_context_table_with_arguments test for consistency.

#[test]
fn render_context_table_with_empty_arguments() {
    let context = TransactionContext {
        tx_hash: "abc123".to_string(),
        ledger_sequence: 12345,
        operation_count: Some(0),
        operation_index: Some(0),
        function_name: Some("transfer".to_string()),
        arguments: vec![],          // ← empty inputs
        fee: FeeBreakdown { /* ... */ },
        resources: ResourceSummary { /* ... */ },
        return_value: None,
    };

    let output = render_context_table(&context);
    assert!(output.is_empty());
}

CI Verification

All CI checks pass locally before opening this PR:

Check Result
cargo fmt --all -- --check ✅ Pass
cargo build --workspace --all-targets --all-features ✅ Pass
cargo test --workspace --all-targets --all-features ✅ 417 tests pass (including the new one)
scripts/lint_taxonomy.sh ✅ Pass
pnpm lint ✅ 0 errors (pre-existing warnings only)
pnpm typecheck ✅ Pass

Motivation

The render_context_table function has an early-return path for empty arguments that was not covered by any test. Adding this test ensures the edge case is explicitly validated, preventing future regressions if the empty-arguments handling is changed.

Closes #424

Add `render_context_table_with_empty_arguments` to verify that
`render_context_table` returns an empty string when the transaction
context has no arguments, exercising the early-return branch that
was previously untested.

Closes Toolbox-Lab#424

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@divysam 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

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8da51ea2-7734-4593-a295-0574574e9cfa


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.

@codeZe-us
codeZe-us self-requested a review August 27, 2026 22:12

@codeZe-us codeZe-us left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR reviewed

@codeZe-us
codeZe-us merged commit d78f25a into Toolbox-Lab:main Aug 27, 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.

Add Unit Test for Argument Table with Empty Inputs

2 participants