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

Commit

Permalink
moare tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajjon committed Dec 3, 2023
1 parent 2ecc675 commit 9a82c58
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ mod tests {
use crate::{
bip32::hd_path::HDPath,
cap26::{
cap26_entity_kind::CAP26EntityKind, cap26_key_kind::CAP26KeyKind, cap26_repr::CAP26Repr,
cap26_entity_kind::CAP26EntityKind, cap26_key_kind::CAP26KeyKind,
cap26_path::paths::is_entity_path::IsEntityPath, cap26_repr::CAP26Repr,
},
derivation::{derivation::Derivation, derivation_path_scheme::DerivationPathScheme},
};
Expand Down Expand Up @@ -308,4 +309,12 @@ mod tests {
Err(HDPathError::WrongEntityKind(525, 618))
);
}

#[test]
fn is_entity_path_index() {
let sut = IdentityPath::placeholder();
assert_eq!(sut.index(), 0);
assert_eq!(sut.network_id(), NetworkID::Mainnet);
assert_eq!(sut.key_kind(), CAP26KeyKind::TransactionSigning);
}
}
10 changes: 10 additions & 0 deletions hierarchical_deterministic/src/derivation/derivation_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,16 @@ mod tests {
assert_eq!(DerivationPath::try_from(hd_path), Ok(derivation_path));
}

#[test]
fn from_cap26() {
let derivation_path: DerivationPath =
CAP26Path::AccountPath(AccountPath::placeholder()).into();
assert_eq!(
derivation_path.derivation_path(),
AccountPath::placeholder().derivation_path()
)
}

#[test]
fn as_cap26_path() {
let path: DerivationPath = AccountPath::placeholder().into();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ mod tests {
use crate::v100::factors::{
factor_source::FactorSource,
factor_sources::device_factor_source::device_factor_source::DeviceFactorSource,
is_factor_source::IsFactorSource,
};

use super::LedgerHardwareWalletFactorSource;
Expand Down Expand Up @@ -135,4 +136,20 @@ mod tests {
Err(Error::ExpectedLedgerHardwareWalletFactorSourceGotSomethingElse)
);
}

#[test]
fn factor_source_id() {
assert_eq!(
LedgerHardwareWalletFactorSource::placeholder().factor_source_id(),
LedgerHardwareWalletFactorSource::placeholder().id.into()
);
}

#[test]
fn factor_source_kind() {
assert_eq!(
LedgerHardwareWalletFactorSource::placeholder().factor_source_kind(),
LedgerHardwareWalletFactorSource::placeholder().id.kind
);
}
}

0 comments on commit 9a82c58

Please sign in to comment.