Skip to content

Commit

Permalink
Fixes tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardocustodio committed Apr 28, 2024
1 parent 12322c3 commit 090f64d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions config-test.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"node": "wss://rpc.matrix.canary.enjin.io:443",
"relay_node": "wss://rpc.relay.canary.enjin.io:443",
"api": "http://localhost:8000/graphql",
"master_key": "store"
"api": "https://platform.canary.enjin.io/graphql",
"master_key": "tests/store"
}
1 change: 1 addition & 0 deletions lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
//! let (poll_job, sign_processor) = create_job_pair(
//! graphql_endpoint,
//! token,
//! String::from("matrix"),
//! Duration::from_millis(6000),
//! Arc::new(connection_pair),
//! 10,
Expand Down
1 change: 1 addition & 0 deletions lib/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ impl RequestExecutor for MockClient {
"node": {
"id": 1,
"encodedData": "0x2800016400000000000000016400000000000000000000000000000000",
"network": "matrix",
"wallet": {
"externalId": null,
"managed": true
Expand Down
13 changes: 7 additions & 6 deletions lib/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ use subxt::{DefaultConfig, Signer};

const EXTRINSIC: &'static str = "2800016400000000000000016400000000000000000000000000000000";
const SIGNED_EXTRINSIC: &'static str = "11028400d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d0128b46d16901b3544e810c23632291ddd224afa4b9bc041df47a7375e1bf3610277eb58041d45fc3ceec2df308601b5139f4f615acf8acf0809d897ddfa695e8e030000002800016400000000000000016400000000000000000000000000000000";
const EXTRINSIC_STORE_SIGNATURE: &'static str = "0100547f46358c6a32dd1ffb28ee537313a674dc3dc882beb3246e03aa4dc246022f01cc0503ca9ba07ad2a4aef55d1b33a8b5b72824d83f603493745c7dadd995c125e62e266d5b841f0feca30dadbfd5193217c65eba4efa6ad05d450200b8ecdf8903000000";
const EXTRINSIC_STORE_SIGNATURE: &'static str = "0100b039724bca229094ce5758143d6801941f2430a993b9e758a9452f91797ebd0d014410bcbeed2e101442818626009f3d0898829ad2f7f3d640d06c5ddcfd9dea7e7f2f2fa28cc4680d8f9550b85c584d6210f8d10638dceff925fae14e3bae958d03000000";
const DERIVED_SIGNED_EXTRINSIC: &'static str = "11028400b2955884765612b245243f634451ffd2e6f3453a70c8dad82d30c6600c0b6010014cb680629ffd3450ecaade6e3f0c17a2b8837966f4fff4c839b699f149d875226eef3bfd15667db83fc27a885af8a2a2795eefe0e7653bed1864daf31309e486030000002800016400000000000000016400000000000000000000000000000000";
const ALICE_ACCOUNT: &'static str = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const STORE_ACCOUNT: &'static str = "5FZY3QFDoLrm8RJXZkEA4EEVZXAXi4FoZhUYuDqQ2xFeNoAM";
const STORE_ACCOUNT: &'static str = "5G3mMFmXkP8gRt6RaSyXNGgLPF5DbYFr4JYcyiDKDCBc1wvq";

const MNEMONIC_PHRASE: &'static str =
"total east north winner target fitness custom prize drive arrange snap dolphin";
Expand Down Expand Up @@ -113,7 +113,7 @@ async fn wallet_derive_works() {
let actual = new_wallet.sign_transaction(extrinsic).await.unwrap();
let expected = hex::decode(DERIVED_SIGNED_EXTRINSIC).unwrap();

// The range [37..100] seems to be dependent on the time of the signature so we don't test for that.
// The range [37..100] seems to be dependent on the time of the signature, so we don't test for that.
assert_eq!(actual.encode()[..37], expected[..37]);
assert_eq!(actual.encode()[101..], expected[101..]);
}
Expand All @@ -122,7 +122,7 @@ const RELAY_NODE_URL: &'static str = "wss://rpc.relay.canary.enjin.io:443";
const NODE_URL: &'static str = "wss://rpc.matrix.canary.enjin.io:443";
const GRAPHQL_URL: &'static str = "https://platform.canary.enjin.io/graphql";
const PLATFORM_AUTH_KEY: &'static str = "KEY";
const KEY_STORAGE: &'static str = "store";
const KEY_STORAGE: &'static str = "tests/store";
const KEY_STORAGE_DEFAULT: &'static str = "store";
const KEY_PASSWORD: &'static str = "TEST";
const CONFIG_FILE: &'static str = "config-test.json";
Expand All @@ -135,8 +135,8 @@ fn set_config_path() {
env::set_var(CONFIG_FILE_ENV_NAME, config_path);
}

// NOTE!: Test that depends on the env varialbes are run serially to prevent errors
// from a test affecting another (Remember to cleanup env variables if they are important to be unset)
// NOTE!: Test that depends on the env variables are run serially to prevent errors
// from a test affecting another (Remember to clean up env variables if they are important to be unset)

#[tokio::test]
#[serial]
Expand Down Expand Up @@ -383,6 +383,7 @@ async fn connector_works() {
.unwrap()
.clone();
let expected_sign = hex::decode(EXTRINSIC_STORE_SIGNATURE).unwrap();

assert_eq!(
transaction_signed.function.encode(),
hex::decode(EXTRINSIC).unwrap()
Expand Down

0 comments on commit 090f64d

Please sign in to comment.