add test_interpret_invalid_asset

This commit is contained in:
Rostyslav Tyshko 2024-10-25 00:37:11 +02:00
parent 150652c779
commit 85102cb893

View File

@ -122,5 +122,14 @@ mod tests {
assert_eq!(interpreted, TestAsset { id: 1, name: "Test".to_string() });
}
#[test]
fn test_interpret_invalid_asset() {
let mut payload = sample_payload();
payload.asset = vec![0, 1, 2, 3]; // Invalid data for deserialization
let utxo = UTXO::create_utxo_from_payload(payload);
// This should fail because the asset is not valid JSON for TestAsset
let result: Result<TestAsset> = utxo.interpret_asset();
assert!(result.is_err());
}
}