Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
add delete_mnemonic_test
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajjon committed Jan 18, 2024
1 parent 766e698 commit ffbc3d7
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions profile/src/wallet/secure_storage/wallet_client_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,4 +271,23 @@ mod tests {
Err(CommonError::UnableToSaveMnemonicToSecureStorage(id.clone()))
);
}

#[test]
fn delete_mnemonic() {
// ARRANGE
let private = PrivateHierarchicalDeterministicFactorSource::placeholder_other();
let factor_source_id = private.factor_source.id.clone();
let (sut, storage) = WalletClientStorage::ephemeral();
let key = SecureStorageKey::DeviceFactorSourceMnemonic {
factor_source_id: factor_source_id.clone(),
};
assert!(storage.save_data(key.clone(), vec![0xde, 0xad]).is_ok());
assert_eq!(storage.load_data(key.clone()), Ok(Some(vec![0xde, 0xad]))); // assert save worked

// ACT
assert!(sut.delete_mnemonic(&factor_source_id).is_ok());

// ASSERT
assert_eq!(storage.load_data(key), Ok(None));
}
}

0 comments on commit ffbc3d7

Please sign in to comment.