Skip to content

Feature: Integration Tests#103

Merged
sephynox merged 46 commits intodevfrom
feat/integration-tests
Feb 26, 2025
Merged

Feature: Integration Tests#103
sephynox merged 46 commits intodevfrom
feat/integration-tests

Conversation

@sephynox
Copy link
Owner

High Level Overview of Change

Adds integration tests.

Context of Change

Adds integration tests that connect to the XRPL testnets. Additionally, fixes NFT support which was broken.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)
  • Documentation Updates
  • Release

Test Plan

Integration tests added.

@sephynox sephynox added bug Something isn't working enhancement New feature or request XRPL Grants This issue is planned to get resoled as part of the XRPL Grants program (within 8 months) labels Feb 22, 2025
@sephynox sephynox self-assigned this Feb 22, 2025
@LimpidCrypto
Copy link
Collaborator

Please change the base of this PR to dev

@LimpidCrypto
Copy link
Collaborator

I assume this fails because we are sending too many requests at once to the faucet URL. Instead we could just have one faucet wallet for testing the transactions which we initialize only once using tokio::sync::OnceCell:

    static CLIENT: tokio::sync::OnceCell<AsyncJsonRpcClient> = tokio::sync::OnceCell::const_new();
    static WALLET: tokio::sync::OnceCell<Wallet> = tokio::sync::OnceCell::const_new();

    async fn get_client() -> &'static AsyncJsonRpcClient {
        CLIENT
            .get_or_init(|| async {
                AsyncJsonRpcClient::connect(Url::parse(XRPL_TEST_NET).unwrap())
            })
            .await
    }
    async fn get_wallet() -> &'static Wallet {
        WALLET
            .get_or_init(|| async {
                generate_faucet_wallet(get_client().await, None, None, None, None)
                    .await
                    .expect("Failed to generate and fund wallet")
            })
            .await
    }

Then we would have the problem, as the tests run all at once and are using the same wallet, causing the transaction all to use the same sequence. So we would maybe need a central function to call and await all these transaction tests like so:

    #[tokio::test]
    async fn test_transactions() {
        test_account_set_transaction().await;
        test_offer_create_transaction().await;
        test_transaction_with_memo().await;
        test_trust_set_transaction().await;
        test_offer_cancel_transaction().await;
    }

@sephynox sephynox changed the base branch from main to feat/result-metadata-type February 25, 2025 20:53
@sephynox sephynox changed the base branch from feat/result-metadata-type to dev February 26, 2025 17:30
@sephynox sephynox closed this Feb 26, 2025
@sephynox sephynox reopened this Feb 26, 2025
@sephynox sephynox merged commit 96c91c9 into dev Feb 26, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request XRPL Grants This issue is planned to get resoled as part of the XRPL Grants program (within 8 months)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants