diff --git a/src/main.rs b/src/main.rs index 944c9733..49ddd707 100644 --- a/src/main.rs +++ b/src/main.rs @@ -110,7 +110,7 @@ mod tests { #[test] fn test_message_deserialize_serialize() { - let sample_message = r#"{"order":{"version":1,"request_id":1,"id":"7dd204d2-d06c-4406-a3d9-4415f4a8b9c9","action":"fiat-sent","content":null}}"#; + let sample_message = r#"{"order":{"version":1,"request_id":1,"trade_index":null,"id":"7dd204d2-d06c-4406-a3d9-4415f4a8b9c9","action":"fiat-sent","payload":null}}"#; let message = Message::from_json(sample_message).unwrap(); assert!(message.verify()); let json_message = message.as_json().unwrap(); @@ -119,7 +119,7 @@ mod tests { #[test] fn test_wrong_message_should_fail() { - let sample_message = r#"{"order":{"version":1,"request_id":1,"action":"take-sell","content":{"order":{"kind":"sell","status":"pending","amount":100,"fiat_code":"XXX","fiat_amount":10,"payment_method":"SEPA","premium":1,"payment_request":null,"created_at":1640839235}}}}"#; + let sample_message = r#"{"order":{"version":1,"request_id":1,"action":"take-sell","payload":{"order":{"kind":"sell","status":"pending","amount":100,"fiat_code":"XXX","fiat_amount":10,"payment_method":"SEPA","premium":1,"payment_request":null,"created_at":1640839235}}}}"#; let message = Message::from_json(sample_message).unwrap(); assert!(!message.verify()); } diff --git a/src/util.rs b/src/util.rs index a6ef387e..8874a6b0 100644 --- a/src/util.rs +++ b/src/util.rs @@ -750,7 +750,15 @@ mod tests { initialize(); // Mock the send_dm function let receiver_pubkey = Keys::generate().public_key(); - let payload = "Test message".to_string(); + let uuid = uuid!("308e1272-d5f4-47e6-bd97-3504baea9c23"); + let message = Message::Order(MessageKind::new( + Some(uuid), + None, + None, + Action::FiatSent, + None, + )); + let payload = message.as_json().unwrap(); let sender_keys = Keys::generate(); let result = send_dm(&receiver_pubkey, sender_keys, payload).await; assert!(result.is_ok());