Skip to content

Commit

Permalink
Add unit tests for the message builder
Browse files Browse the repository at this point in the history
  • Loading branch information
felipet committed Oct 11, 2024
1 parent 2a67f67 commit 6e2660f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/data_objects/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,3 +268,27 @@ pub enum Track {
#[serde(rename = "enabled")]
Enabled,
}

#[cfg(test)]
mod tests {
use super::*;
use pretty_assertions::assert_eq;
use rstest::*;

#[rstest]
fn message_builds() {
let test_email = "[email protected]";
let name = Some("name");
let body = "a test body";

let message = MessageBuilder::default()
.with_from(test_email, name)
.with_to(test_email, name)
.with_text_body(body)
.build();

assert_eq!(message.from.email, test_email);
assert_eq!(message.from.name.as_deref(), name);
assert_eq!(message.text_part.as_deref(), Some(body));
}
}

0 comments on commit 6e2660f

Please sign in to comment.