From c49428a7941a8307ff754e596edec575e411cec1 Mon Sep 17 00:00:00 2001 From: Alexander Cyon Date: Tue, 16 Jan 2024 18:36:41 +0100 Subject: [PATCH] More tests --- profile/src/logic/profile_next_derivation.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/profile/src/logic/profile_next_derivation.rs b/profile/src/logic/profile_next_derivation.rs index 0f60125f..87a779a0 100644 --- a/profile/src/logic/profile_next_derivation.rs +++ b/profile/src/logic/profile_next_derivation.rs @@ -134,4 +134,24 @@ mod tests { Err(CommonError::ProfileDoesNotContainFactorSourceWithID(lfs.factor_source_id())) ); } + + #[test] + fn device_factor_source_by_id_success_device() { + let profile = Profile::placeholder(); + let dfs = DeviceFactorSource::placeholder_babylon(); + assert_eq!(profile.device_factor_source_by_id(&dfs.id), Ok(dfs)); + } + + #[test] + fn device_factor_source_by_id_fail_unknown_id() { + let profile = Profile::placeholder(); + + let id = + FactorSourceIDFromHash::new_for_device(MnemonicWithPassphrase::placeholder_other()); + + assert_eq!( + profile.device_factor_source_by_id(&id), + Err(CommonError::ProfileDoesNotContainFactorSourceWithID(id.into())) + ); + } }