Skip to content

Commit

Permalink
refactor: use single constant
Browse files Browse the repository at this point in the history
  • Loading branch information
evilrobot-01 committed Dec 9, 2024
1 parent ab4f1f8 commit 02bbad1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
3 changes: 1 addition & 2 deletions crates/pop-parachains/src/call/metadata/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,10 @@ pub fn supported_actions(pallets: &[Pallet]) -> Vec<Action> {
#[cfg(test)]
mod tests {
use super::*;
use crate::{parse_chain_metadata, set_up_client};
use crate::{call::tests::POP_NETWORK_TESTNET_URL, parse_chain_metadata, set_up_client};
use anyhow::Result;
use std::collections::HashMap;

const POP_NETWORK_TESTNET_URL: &str = "wss://rpc1.paseo.popnetwork.xyz";
const POLKADOT_NETWORK_URL: &str = "wss://polkadot-rpc.publicnode.com";

#[test]
Expand Down
4 changes: 1 addition & 3 deletions crates/pop-parachains/src/call/metadata/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,10 @@ pub fn parse_extrinsic_arguments(
mod tests {
use super::*;

use crate::set_up_client;
use crate::{call::tests::POP_NETWORK_TESTNET_URL, set_up_client};
use anyhow::Result;
use subxt::ext::scale_bits;

const POP_NETWORK_TESTNET_URL: &str = "wss://rpc1.paseo.popnetwork.xyz";

#[tokio::test]
async fn parse_chain_metadata_works() -> Result<()> {
let client = set_up_client(POP_NETWORK_TESTNET_URL).await?;
Expand Down
4 changes: 1 addition & 3 deletions crates/pop-parachains/src/call/metadata/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,9 @@ fn type_to_param(name: String, registry: &PortableRegistry, type_id: u32) -> Res
#[cfg(test)]
mod tests {
use super::*;
use crate::set_up_client;
use crate::{call::tests::POP_NETWORK_TESTNET_URL, set_up_client};
use anyhow::Result;

const POP_NETWORK_TESTNET_URL: &str = "wss://rpc1.paseo.popnetwork.xyz";

#[tokio::test]
async fn field_to_param_works() -> Result<()> {
let client = set_up_client(POP_NETWORK_TESTNET_URL).await?;
Expand Down
6 changes: 3 additions & 3 deletions crates/pop-parachains/src/call/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ mod tests {
use anyhow::Result;

const ALICE_SURI: &str = "//Alice";
const POP_NETWORK_TESTNET_URL: &str = "wss://rpc1.paseo.popnetwork.xyz";
pub(crate) const POP_NETWORK_TESTNET_URL: &str = "wss://rpc1.paseo.popnetwork.xyz";

#[tokio::test]
async fn set_up_client_works() -> Result<()> {
Expand Down Expand Up @@ -196,7 +196,7 @@ mod tests {
#[tokio::test]
async fn decode_call_data_works() -> Result<()> {
assert!(matches!(decode_call_data("wrongcalldata"), Err(Error::CallDataDecodingError(..))));
let client = set_up_client("wss://rpc1.paseo.popnetwork.xyz").await?;
let client = set_up_client(POP_NETWORK_TESTNET_URL).await?;
let pallets = parse_chain_metadata(&client)?;
let remark = find_extrinsic_by_name(&pallets, "System", "remark")?;
let extrinsic = construct_extrinsic("System", &remark, vec!["0x11".to_string()])?;
Expand Down Expand Up @@ -225,7 +225,7 @@ mod tests {

#[tokio::test]
async fn construct_sudo_extrinsic_works() -> Result<()> {
let client = set_up_client("wss://rpc1.paseo.popnetwork.xyz").await?;
let client = set_up_client(POP_NETWORK_TESTNET_URL).await?;
let pallets = parse_chain_metadata(&client)?;
let force_transfer = find_extrinsic_by_name(&pallets, "Balances", "force_transfer")?;
let extrinsic = construct_extrinsic(
Expand Down

0 comments on commit 02bbad1

Please sign in to comment.