Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

Commit

Permalink
add `validation_for_addition_of_factor_source_of_kind_to_confirmation…
Browse files Browse the repository at this point in the history
…_override` tests
  • Loading branch information
CyonAlexRDX committed Nov 26, 2024
1 parent 8d6839e commit f454d9b
Showing 1 changed file with 48 additions and 4 deletions.
52 changes: 48 additions & 4 deletions crates/rules/src/matrix_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ mod tests {

#[test]
fn validation_for_addition_of_factor_source_of_kind_to_recovery_override_empty() {
let mut sut = make();
let sut = make();
let test = |kind: FactorSourceKind, should_be_ok: bool| {
let is_ok = sut
.validation_for_addition_of_factor_source_of_kind_to_recovery_override(kind)
Expand All @@ -997,9 +997,6 @@ mod tests {
test(FactorSourceKind::Passphrase, false);
test(FactorSourceKind::OffDeviceMnemonic, true);
test(FactorSourceKind::TrustedContact, true);

sut.add_factor_source_to_recovery_override(FactorSourceID::sample_ledger())
.unwrap();
}

#[test]
Expand All @@ -1024,6 +1021,53 @@ mod tests {
}
}

mod confirmation {
use super::*;

#[test]
fn validation_for_addition_of_factor_source_of_kind_to_confirmation_override_empty() {
let sut = make();
let test = |kind: FactorSourceKind, should_be_ok: bool| {
let is_ok = sut
.validation_for_addition_of_factor_source_of_kind_to_confirmation_override(
kind,
)
.is_ok();
assert_eq!(is_ok, should_be_ok);
};
test(FactorSourceKind::Device, true);
test(FactorSourceKind::LedgerHQHardwareWallet, true);
test(FactorSourceKind::ArculusCard, true);
test(FactorSourceKind::SecurityQuestions, true);
test(FactorSourceKind::Passphrase, true);
test(FactorSourceKind::OffDeviceMnemonic, true);
test(FactorSourceKind::TrustedContact, false);
}

#[test]
fn validation_for_addition_of_factor_source_of_kind_to_confirmation_override_single_recovery(
) {
let mut sut = make();
sut.add_factor_source_to_confirmation_override(FactorSourceID::sample_ledger())
.unwrap();
let test = |kind: FactorSourceKind, should_be_ok: bool| {
let is_ok = sut
.validation_for_addition_of_factor_source_of_kind_to_confirmation_override(
kind,
)
.is_ok();
assert_eq!(is_ok, should_be_ok);
};
test(FactorSourceKind::Device, true);
test(FactorSourceKind::LedgerHQHardwareWallet, true);
test(FactorSourceKind::ArculusCard, true);
test(FactorSourceKind::SecurityQuestions, true);
test(FactorSourceKind::Passphrase, true);
test(FactorSourceKind::OffDeviceMnemonic, true);
test(FactorSourceKind::TrustedContact, false);
}
}

mod primary {
use super::*;

Expand Down

0 comments on commit f454d9b

Please sign in to comment.