Skip to content

Commit

Permalink
test: fixing unit tests and clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
djavorek committed Nov 2, 2023
1 parent 1d49911 commit 5841f42
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion server/core/src/logic/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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)
}
};
}

Expand Down
4 changes: 2 additions & 2 deletions server/core/src/logic/expense_operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -141,7 +141,7 @@ pub async fn find_predefined_expenses(
let mut recurrences: VecDeque<recurrence::Model> = 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"
Expand Down

0 comments on commit 5841f42

Please sign in to comment.