Skip to content

Commit

Permalink
test(wallet): refactor stash/unstash test
Browse files Browse the repository at this point in the history
  • Loading branch information
mickvandijke committed Jul 18, 2024
1 parent 3406d72 commit 6e86f96
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sn_transfers/src/wallet/hot_wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ impl HotWallet {
let addr_hex = wallet_pub_key.to_hex();
let new_name = format!("{WALLET_DIR_NAME}_{addr_hex}");
let moved_dir = root_dir.join(new_name);
let _ = std::fs::rename(wallet_dir, moved_dir.clone());
std::fs::rename(wallet_dir, moved_dir.clone())?;
Ok(moved_dir)
}

Expand Down Expand Up @@ -1237,13 +1237,13 @@ mod tests {
let pub_key_hex_str = wallet.address().to_hex();

// Stash wallet
assert!(HotWallet::stash(&root_dir).is_ok());
HotWallet::stash(&root_dir)?;

// There should be no active wallet now
assert!(HotWallet::load_from(&root_dir).is_err());

// Unstash wallet
assert!(HotWallet::unstash(&root_dir, &pub_key_hex_str).is_ok());
HotWallet::unstash(&root_dir, &pub_key_hex_str)?;

let unstashed_wallet = HotWallet::load_from(&root_dir)?;

Expand Down

0 comments on commit 6e86f96

Please sign in to comment.