Skip to content

Commit

Permalink
fix kotlin tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CyonAlexRDX committed Feb 11, 2025
1 parent 48900e8 commit f825460
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ pub struct AddressesOfAccessController {
pub xrd_vault_address: VaultAddress,
}

delegate_debug_into!(
AddressesOfAccessController,
InternalAddressesOfAccessController
);

/// Advanced security control of an entity which has been "securified",
/// meaning an MFA security structure (`SecurityStructureOfFactorSources`)
/// which user has created has been applied to it.
Expand Down Expand Up @@ -46,3 +51,64 @@ pub struct SecuredEntityControl {
/// is about to change to
pub provisional_securified_config: Option<ProvisionalSecurifiedConfig>,
}

delegate_debug_into!(SecuredEntityControl, InternalSecuredEntityControl);

#[uniffi::export]
pub fn new_addresses_of_access_controller_sample() -> AddressesOfAccessController
{
InternalAddressesOfAccessController::sample().into()
}

#[uniffi::export]
pub fn new_addresses_of_access_controller_sample_other(
) -> AddressesOfAccessController {
InternalAddressesOfAccessController::sample_other().into()
}

#[uniffi::export]
pub fn new_secured_entity_control_sample() -> SecuredEntityControl {
InternalSecuredEntityControl::sample().into()
}

#[uniffi::export]
pub fn new_secured_entity_control_sample_other() -> SecuredEntityControl {
InternalSecuredEntityControl::sample_other().into()
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn secured_entity_control_samples() {
assert_eq!(
new_secured_entity_control_sample(),
new_secured_entity_control_sample()
);
assert_eq!(
new_secured_entity_control_sample_other(),
new_secured_entity_control_sample_other()
);
assert_ne!(
new_secured_entity_control_sample(),
new_secured_entity_control_sample_other()
);
}

#[test]
fn addresses_of_access_controller_samples() {
assert_eq!(
new_addresses_of_access_controller_sample(),
new_addresses_of_access_controller_sample()
);
assert_eq!(
new_addresses_of_access_controller_sample_other(),
new_addresses_of_access_controller_sample_other(),
);
assert_ne!(
new_addresses_of_access_controller_sample(),
new_addresses_of_access_controller_sample_other(),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,7 @@ class AccountTest : SampleTestable<Account> {
address = AccountAddress.sampleMainnet(),
displayName = DisplayName.init("Securified"),
securityState = EntitySecurityState.Securified(
SecuredEntityControl(
veci = HierarchicalDeterministicFactorInstance.sample(),
accessControllerAddress = AccessControllerAddress.sampleMainnet(),
securityStructure = SecurityStructureOfFactorInstances.sample(),
provisionalSecurifiedConfig = null
)
newSecuredEntityControlSampleOther()
),
appearanceId = AppearanceId.sample(),
flags = emptyList(),
Expand Down

0 comments on commit f825460

Please sign in to comment.