diff --git a/src/main.rs b/src/main.rs index 7162d79b..9b93bf03 100644 --- a/src/main.rs +++ b/src/main.rs @@ -65,20 +65,11 @@ async fn main() -> Result<()> { #[cfg(test)] mod tests { use mostro_core::message::Message; - use mostro_core::order::SmallOrder; use std::time::{SystemTime, UNIX_EPOCH}; - #[test] - fn test_order_deserialize_serialize() { - let sample_order = r#"{"kind":"Sell","status":"Pending","amount":100,"fiat_code":"XXX","fiat_amount":10,"payment_method":"belo","premium":1,"created_at":0}"#; - let order = SmallOrder::from_json(sample_order).unwrap(); - let json_order = order.as_json().unwrap(); - assert_eq!(sample_order, json_order); - } - #[test] fn test_message_deserialize_serialize() { - let sample_message = r#"{"version":0,"order_id":"7dd204d2-d06c-4406-a3d9-4415f4a8b9c9","pubkey":null,"action":"TakeSell","content":{"PaymentRequest":[null,"lnbc1..."]}}"#; + let sample_message = r#"{"Order":{"version":1,"id":"7dd204d2-d06c-4406-a3d9-4415f4a8b9c9","pubkey":null,"action":"FiatSent","content":null}}"#; let message = Message::from_json(sample_message).unwrap(); assert!(message.verify()); let json_message = message.as_json().unwrap(); @@ -87,7 +78,7 @@ mod tests { #[test] fn test_wrong_message_should_fail() { - let sample_message = r#"{"version":0,"action":"TakeSell","content":{"Order":{"kind":"Sell","status":"Pending","amount":100,"fiat_code":"XXX","fiat_amount":10,"payment_method":"belo","premium":1,"payment_request":null,"created_at":1640839235}}}"#; + let sample_message = r#"{"Order":{"version":1,"pubkey":null,"action":"TakeSell","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 message = Message::from_json(sample_message).unwrap(); assert!(!message.verify()); }