From 5841f42962a104a40d341c03a5990f4cbfe30ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javorek=20D=C3=A9nes?= Date: Thu, 2 Nov 2023 22:34:27 +0100 Subject: [PATCH] test: fixing unit tests and clippy --- server/core/src/logic/common.rs | 5 ++++- server/core/src/logic/expense_operations.rs | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/server/core/src/logic/common.rs b/server/core/src/logic/common.rs index 60a4c68..52b0af4 100644 --- a/server/core/src/logic/common.rs +++ b/server/core/src/logic/common.rs @@ -23,7 +23,7 @@ pub mod tests { use sea_orm::{DatabaseBackend, DeriveActiveModelBehavior, DeriveEntityModel, MockDatabase}; use std::net::{IpAddr, Ipv4Addr, SocketAddr}; - use crate::config::{AppConfig, MailConfig}; + use crate::config::{AppConfig, MailConfig, MetricsConfig}; use crate::logic::common::find_entity_by_id; pub const TEST_STR: &str = "test"; @@ -128,6 +128,9 @@ pub mod tests { smtp_username: TEST_STR.to_string(), smtp_password: TEST_STR.to_string(), }, + metrics_config: MetricsConfig { + metrics_address: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 3001) + } }; } diff --git a/server/core/src/logic/expense_operations.rs b/server/core/src/logic/expense_operations.rs index 8613879..d1631b5 100644 --- a/server/core/src/logic/expense_operations.rs +++ b/server/core/src/logic/expense_operations.rs @@ -48,7 +48,7 @@ pub async fn find_expenses_by_user_id( let recurrences = recurrences?; assert!( - vec![predefined_expenses.len(), grouped_transactions.len()] + [predefined_expenses.len(), grouped_transactions.len()] .iter() .all(|&x| x == expenses.len()), "the lengths of the fetched expense related lists should always be equal" @@ -141,7 +141,7 @@ pub async fn find_predefined_expenses( let mut recurrences: VecDeque = recurrences?.into_iter().flatten().collect(); assert!( - vec![currencies.len(), recurrences.len()] + [currencies.len(), recurrences.len()] .iter() .all(|&x| x == predefined_expenses.len()), "the lengths of the fetched predefined expense related lists should be equal"