fix: ordering of items and allow large_enum_variant in test module

This commit is contained in:
Moudy 2026-04-03 15:40:55 +02:00
parent bc0583368d
commit 9fb55a75d6

View File

@ -3469,22 +3469,12 @@ pub mod tests {
}
}
#[test]
fn state_serialization_roundtrip() {
let account_id_1 = AccountId::new([1; 32]);
let account_id_2 = AccountId::new([2; 32]);
let initial_data = [(account_id_1, 100_u128), (account_id_2, 151_u128)];
let state = V03State::new_with_genesis_accounts(&initial_data, &[]).with_test_programs();
let bytes = borsh::to_vec(&state).unwrap();
let state_from_bytes: V03State = borsh::from_slice(&bytes).unwrap();
assert_eq!(state, state_from_bytes);
}
// ── Flash Swap integration tests ──────────────────────────────────────────
/// Mirror of the guest `FlashSwapInstruction` enum so we can serialise
/// instructions on the host side.
#[derive(serde::Serialize, serde::Deserialize)]
#[allow(clippy::large_enum_variant)]
enum FlashSwapInstruction {
Initiate {
token_program_id: ProgramId,
@ -3531,6 +3521,17 @@ pub mod tests {
PublicTransaction::new(message, witness_set)
}
#[test]
fn state_serialization_roundtrip() {
let account_id_1 = AccountId::new([1; 32]);
let account_id_2 = AccountId::new([2; 32]);
let initial_data = [(account_id_1, 100_u128), (account_id_2, 151_u128)];
let state = V03State::new_with_genesis_accounts(&initial_data, &[]).with_test_programs();
let bytes = borsh::to_vec(&state).unwrap();
let state_from_bytes: V03State = borsh::from_slice(&bytes).unwrap();
assert_eq!(state, state_from_bytes);
}
#[test]
fn flash_swap_successful() {
let initiator = Program::flash_swap_initiator();