v0.2.6-pre.006

This commit is contained in:
2026-08-21 10:01:11 +02:00
parent 63e711629f
commit a207cf7161
21 changed files with 1136 additions and 63 deletions

View File

@@ -0,0 +1,34 @@
// file: crates/ksp-app-wallet-desk/unit_tests/wallet_secrets.rs
// version: 1
#[test]
fn filename_secret_label_normalization_is_deterministic_and_never_uses_internal_alias() {
assert_eq!(super::normalize_wallet_secret_label("wallet-01.kspwallet"), "WALLET_01");
assert_eq!(super::normalize_wallet_secret_label(" treasury.main .kspwallet"), "TREASURY_MAIN");
assert_eq!(super::normalize_wallet_secret_label("a___b...c.kspwallet"), "A_B_C");
assert_eq!(super::normalize_wallet_secret_label(".kspwallet"), "");
}
#[test]
fn candidate_order_prefers_filename_then_numeric_then_named_labels() {
let mut names = vec![
format!("{}TREASURY", super::WALLET_SECRET_PREFIX),
format!("{}10", super::WALLET_SECRET_PREFIX),
format!("{}WALLET_01", super::WALLET_SECRET_PREFIX),
format!("{}02", super::WALLET_SECRET_PREFIX),
format!("{}01", super::WALLET_SECRET_PREFIX),
format!("{}ALPHA", super::WALLET_SECRET_PREFIX),
];
super::order_wallet_secret_candidate_names("wallet-01.kspwallet", names.as_mut_slice());
assert_eq!(
names,
vec![
format!("{}WALLET_01", super::WALLET_SECRET_PREFIX),
format!("{}01", super::WALLET_SECRET_PREFIX),
format!("{}02", super::WALLET_SECRET_PREFIX),
format!("{}10", super::WALLET_SECRET_PREFIX),
format!("{}ALPHA", super::WALLET_SECRET_PREFIX),
format!("{}TREASURY", super::WALLET_SECRET_PREFIX),
]
);
}

View File

@@ -1,7 +1,7 @@
// file: crates/ksp-app-wallet-desk/unit_tests/wallet_session.rs
// version: 1
// version: 2
//! Unit tests for Wallet Desk session DTOs and OWNER projection.
//! Unit tests for Wallet Desk session DTOs and password request boundaries.
#[test]
fn no_selection_projection_contains_no_wallet_identity() {
@@ -24,3 +24,16 @@ fn create_request_does_not_require_debug_or_clone_password_contracts() {
};
accepts_request(request);
}
#[test]
fn unlock_request_does_not_require_debug_or_clone_password_contracts() {
fn accepts_request(_: crate::WalletUnlockRequestDto) {}
let request = crate::WalletUnlockRequestDto { password: "operator-test-unlock".to_owned() };
accepts_request(request);
}
#[test]
fn session_state_contract_includes_view_owner_and_privileged_operation() {
assert_ne!(crate::WalletSessionStateDto::ViewOpen, crate::WalletSessionStateDto::OwnerOpen);
assert_ne!(crate::WalletSessionStateDto::PrivilegedOperation, crate::WalletSessionStateDto::Locked);
}