From d08b418d59fa7aab094e991e710f9eed6fd8a080 Mon Sep 17 00:00:00 2001 From: Waffle Date: Fri, 6 Sep 2019 01:23:14 +0300 Subject: [PATCH] Add `ParseMode` serialization tests --- src/core/types/parse_mode.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/core/types/parse_mode.rs b/src/core/types/parse_mode.rs index a1e7a0ca..f50d1fc4 100644 --- a/src/core/types/parse_mode.rs +++ b/src/core/types/parse_mode.rs @@ -68,3 +68,25 @@ pub enum ParseMode { HTML, Markdown, } + + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn html_serialization() { + let expected_json = String::from(r#""HTML""#); + let actual_json = serde_json::to_string(&ParseMode::HTML).unwrap(); + + assert_eq!(expected_json, actual_json) + } + + #[test] + fn markdown_serialization() { + let expected_json = String::from(r#""Markdown""#); + let actual_json = serde_json::to_string(&ParseMode::Markdown).unwrap(); + + assert_eq!(expected_json, actual_json) + } +}