From e75449410f136e9b781025583bdff74216da1847 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sat, 14 Jan 2023 03:22:42 +0900 Subject: [PATCH] Add test for Fqn --- plume-models/src/lib.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/plume-models/src/lib.rs b/plume-models/src/lib.rs index 335622f7..9e901f16 100644 --- a/plume-models/src/lib.rs +++ b/plume-models/src/lib.rs @@ -413,7 +413,7 @@ where #[cfg(test)] #[macro_use] mod tests { - use crate::{db_conn, migrations::IMPORTED_MIGRATIONS, Connection as Conn, CONFIG}; + use crate::{db_conn, migrations::IMPORTED_MIGRATIONS, Connection as Conn, CONFIG, Fqn}; use chrono::{naive::NaiveDateTime, Datelike, Timelike}; use diesel::r2d2::ConnectionManager; use plume_common::utils::random_hex; @@ -474,6 +474,20 @@ mod tests { dt.second() ) } + + #[test] + fn fqn() { + assert_eq!( + Fqn::new_local("admin".to_string()).unwrap(), + Fqn::new_local("admin".to_string()).unwrap() + ); + assert!(Fqn::new_local("admin".to_string()).is_ok()); + let fqn = Fqn::new_local("admin".to_string()).unwrap(); + assert_eq!("admin".to_string(), String::from(&fqn)); + let fqn = Fqn::new_local("admin".to_string()).unwrap(); + assert_eq!("admin".to_string(), ToString::to_string(&fqn)); + assert_eq!("admin".to_string(), fqn.to_string()); + } } pub mod admin;