v0.2.6-pre.016-fix.002

This commit is contained in:
2026-08-22 08:37:56 +02:00
parent 738b340cc7
commit 5c0be421da
10 changed files with 206 additions and 159 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-wallet-lib/unit_tests/format.rs
// version: 1
// version: 2
#[test]
fn default_and_latest_are_explicit_and_currently_v2() {
@@ -12,7 +12,15 @@ fn default_and_latest_are_explicit_and_currently_v2() {
fn detector_distinguishes_v1_json_and_v2_binary_without_crypto() -> ksp_core_lib::Result<()> {
let v1 = include_bytes!("../tests/fixtures/kspwallet_v1_wire_only.json");
let v2 = include_bytes!("../tests/fixtures/kspwallet_v2_wire_only.bin");
assert_eq!(crate::detect_wallet_format(v1)?, crate::WalletFormat::V1);
assert_eq!(crate::detect_wallet_format(v2)?, crate::WalletFormat::V2);
let detected_v1 = match crate::detect_wallet_format(v1) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
let detected_v2 = match crate::detect_wallet_format(v2) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
assert_eq!(detected_v1, crate::WalletFormat::V1);
assert_eq!(detected_v2, crate::WalletFormat::V2);
return std::result::Result::Ok(());
}