// file: crates/ksp-wallet-lib/unit_tests/format.rs // version: 2 #[test] fn default_and_latest_are_explicit_and_currently_v2() { assert_eq!(crate::DEFAULT_WALLET_FORMAT, crate::WalletFormat::V2); assert_eq!(crate::LATEST_SUPPORTED_WALLET_FORMAT, crate::WalletFormat::V2); assert_eq!(crate::DEFAULT_WALLET_FORMAT.version(), crate::KSPWALLET_FORMAT_VERSION_V2); } #[test] 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"); 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(()); }