Skip to content

Commit

Permalink
test: declare test with Katana
Browse files Browse the repository at this point in the history
  • Loading branch information
ICavlek committed Aug 29, 2024
1 parent 331d5ef commit 3a21504
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ jobs:
- uses: Swatinem/rust-cache@v2
- run: cargo test --features skip-zero-root-validation

test-katana:
if: ${{ !startsWith(github.head_ref, 'dependabot/') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cd .. && git clone https://github.com/dojoengine/dojo
- run: cd ../dojo && git reset --hard v1.0.0-alpha.7 && cargo run --bin katana -- --host 127.0.0.1 -p 5050 --disable-fee &
- run: sleep 500 && cargo test -- --ignored

check:
if: startsWith(github.head_ref, 'dependabot/')
runs-on: ubuntu-latest
Expand Down
33 changes: 33 additions & 0 deletions tests/account_declaration.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
use beerus::gen::{client::Client, Address, BlockId, BlockTag, Felt, Rpc};

mod common;

#[ignore]
#[tokio::test]
async fn declare_account() {
let url = "http://127.0.0.1:5050";
let client = Client::new(url);

let res_chain_id = client.chainId().await;
assert!(res_chain_id.is_ok());
assert_eq!(res_chain_id.unwrap().as_ref(), "0x4b4154414e41");

let block_id = BlockId::BlockTag(BlockTag::Pending);
let class_hash = Felt::try_new(
"0x6b46f84b1bbb779e588a9c5f577907c3dfb66e6b13cf4c4f480d4fb1677c2ba",
)
.unwrap();
let res_class = client.getClass(block_id.clone(), class_hash).await;
assert!(res_class.is_err());
assert!(res_class.unwrap_err().message.contains("Class hash not found"));

let contract_address = Address(
Felt::try_new(
"0x6162896d1d7ab204c7ccac6dd5f8e9e7c25ecd5ae4fcb4ad32e57786bb46e03",
)
.unwrap(),
);
let res_nonce = client.getNonce(block_id, contract_address).await;
assert!(res_nonce.is_ok());
assert_eq!(res_nonce.unwrap().as_ref(), "0x0");
}

0 comments on commit 3a21504

Please sign in to comment.