Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test coverage for edge cases in empty swaps #126

Open
mantricjavier opened this issue Feb 13, 2025 · 0 comments
Open

Add test coverage for edge cases in empty swaps #126

mantricjavier opened this issue Feb 13, 2025 · 0 comments

Comments

@mantricjavier
Copy link
Collaborator

Underlying issue

The rejects_empty_swaps test could be expanded to cover more edge cases like:

Empty swap operations with non-empty funds
Empty funds with non-empty swap operations

#[test]
fn rejects_empty_swaps() {
    // Existing test case

    // Add test for empty swap operations with funds
    suite.execute_swap_operations(
        &creator,
        vec![],
        None,
        None,
        None,
        vec![coin(1000u128, "uwhale".to_string())],
        |result| {
            assert_eq!(
                result.unwrap_err().downcast_ref::<ContractError>(),
                Some(&ContractError::NoSwapOperationsProvided)
            )
        },
    );

    // Add test for non-empty swap operations with no funds
    suite.execute_swap_operations(
        &creator,
        swap_operations,
        None,
        None,
        None,
        vec![],
        |result| {
            assert_eq!(
                result.unwrap_err().downcast_ref::<ContractError>(),
                Some(&ContractError::NoFundsProvided)
            )
        },
    );
}

Suggestions

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

No branches or pull requests

1 participant