From 1881b9efb94f1b2571f7c34508f53ca2c99a9abc Mon Sep 17 00:00:00 2001 From: Cameron Cordes Date: Wed, 20 Mar 2024 22:16:06 -0400 Subject: [PATCH] Trim spaces from new tags Fix unit test build --- src/files.rs | 3 ++- src/tags.rs | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/files.rs b/src/files.rs index db96067..93ceb6c 100644 --- a/src/files.rs +++ b/src/files.rs @@ -424,7 +424,8 @@ mod tests { assert_eq!(status, 200); let body: PhotosResponse = serde_json::from_str(&response.read_to_str()).unwrap(); - + debug!("{:?}", body); + assert!(body.photos.contains(&String::from("photo.jpg"))); assert!(body.dirs.contains(&String::from("test-dir"))); assert!(body diff --git a/src/tags.rs b/src/tags.rs index e478022..741834d 100644 --- a/src/tags.rs +++ b/src/tags.rs @@ -41,7 +41,7 @@ async fn add_tag( if let Some((_, tag)) = tags.iter().find(|t| t.1.name == tag_name) { Ok(tag.clone()) } else { - tag_dao.create_tag(&tag_name) + tag_dao.create_tag(tag_name.trim()) } }) .and_then(|tag| tag_dao.tag_file(&body.file_name, tag.id)) @@ -491,6 +491,10 @@ mod tests { ) -> anyhow::Result> { todo!() } + + fn get_files_with_any_tag_ids(&mut self, tag_ids: Vec) -> anyhow::Result> { + todo!() + } } #[actix_rt::test]