From 1fcd6c5941a4e08c7a08bdab80c7cc04e23663fc Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Tue, 31 Jul 2018 22:35:02 +0200 Subject: [PATCH] bookmarks: Add a test for all of the elements. --- src/bookmarks.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/bookmarks.rs b/src/bookmarks.rs index 4c449fa..bf81335 100644 --- a/src/bookmarks.rs +++ b/src/bookmarks.rs @@ -88,4 +88,19 @@ mod tests { let elem2 = Element::from(Storage::new()); assert!(elem1.compare_to(&elem2)); } + + #[test] + fn complete() { + let elem: Element = "Coucousecret".parse().unwrap(); + let storage = Storage::try_from(elem).unwrap(); + assert_eq!(storage.urls.len(), 1); + assert_eq!(storage.urls[0].name, "Example"); + assert_eq!(storage.urls[0].url, "https://example.org/"); + assert_eq!(storage.conferences.len(), 1); + assert_eq!(storage.conferences[0].autojoin, Autojoin::True); + assert_eq!(storage.conferences[0].jid, Jid::bare("test-muc", "muc.localhost")); + assert_eq!(storage.conferences[0].name, "Test MUC"); + assert_eq!(storage.conferences[0].clone().nick.unwrap(), "Coucou"); + assert_eq!(storage.conferences[0].clone().password.unwrap(), "secret"); + } }