Skip to content

Commit

Permalink
Add broadcast parse test
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoniosBarotsis committed Dec 25, 2024
1 parent 6a5adc8 commit f619804
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/broadcasts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ mod test {
Result,
};

use super::types::Broadcast;

#[tokio_shared_rt::test(shared = true)]
#[cfg(not(feature = "blocking"))]
async fn create_send_broadcast() -> Result<()> {
Expand Down Expand Up @@ -332,4 +334,24 @@ mod test {

Ok(())
}

#[test]
fn parse_broadcast_test() {
let data = r#"{
"object": "broadcast",
"id": "498ee8e4-7aa2-4eb5-9f04-4194848049d1",
"name": "Untitled",
"audience_id": "fd644f07-a05a-467e-9bae-23bb7c35766a",
"from": "Acme <[email protected]>",
"subject": "Hello!",
"reply_to": [],
"preview_text": null,
"status": "scheduled",
"created_at": "2024-12-18 18:05:09.905933+00",
"scheduled_at": null,
"sent_at": null
}"#;

let _parsed = serde_json::from_str::<Broadcast>(data).expect("Parsing failed");
}
}

0 comments on commit f619804

Please sign in to comment.