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

Commit

Permalink
Add tests for factor_source_by_id (happy paths)
Browse files Browse the repository at this point in the history
  • Loading branch information
CyonAlexRDX committed Jan 16, 2024
1 parent becc94a commit 45bf9f2
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions profile/src/logic/profile_next_derivation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,30 @@ impl Profile {
return index as HDPathValue;
}
}

#[cfg(test)]
mod tests {

use crate::prelude::*;

#[test]
fn factor_source_by_id_success_device() {
let profile = Profile::placeholder();
let dfs = DeviceFactorSource::placeholder_babylon();
assert_eq!(
profile.factor_source_by_id::<DeviceFactorSource>(&dfs.factor_source_id()),
Ok(dfs)
);
}

#[test]
fn factor_source_by_id_success_ledger() {
let profile = Profile::placeholder();
let lfs = LedgerHardwareWalletFactorSource::placeholder();
assert_eq!(
profile
.factor_source_by_id::<LedgerHardwareWalletFactorSource>(&lfs.factor_source_id()),
Ok(lfs)
);
}
}

0 comments on commit 45bf9f2

Please sign in to comment.