From b2814a86a3f64a54c7d31d952a6b327747036b5c Mon Sep 17 00:00:00 2001 From: Aytixel Date: Tue, 16 Jul 2024 11:36:04 +0200 Subject: [PATCH] fix: feedback test not passing sometimes --- src/async.rs | 10 ++++++---- src/blocking.rs | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/async.rs b/src/async.rs index 0594886..462e99a 100644 --- a/src/async.rs +++ b/src/async.rs @@ -720,8 +720,6 @@ mod tests { let all_feedback = vec![ Feedback::new("read", "10", "3", "2022-11-20T13:55:27Z"), Feedback::new("read", "10", "4", "2022-11-20T13:55:27Z"), - Feedback::new("read", "1000", "300", "2022-11-20T13:55:27Z"), - Feedback::new("read", "1000", "400", "2022-11-20T13:55:27Z"), ]; let feedback = vec![ Feedback::new("read", "10", "3", "2022-11-20T13:55:27Z"), @@ -746,12 +744,16 @@ mod tests { assert_eq!(rows_affected.row_affected, 2); // List feedback. let return_feedback = client.list_feedback(&CursorQuery::new()).await?; - assert_eq!(return_feedback, all_feedback); + assert!(all_feedback + .iter() + .all(|feedback| return_feedback.contains(feedback))); // List feedback by type. let return_feedback = client .list_feedback_by_type("read", &CursorQuery::new()) .await?; - assert_eq!(return_feedback, all_feedback); + assert!(all_feedback + .iter() + .all(|feedback| return_feedback.contains(feedback))); // Get feedback. let return_feedback = client.get_feedback("read", "10", "3").await?; assert_eq!(return_feedback, feedback[0]); diff --git a/src/blocking.rs b/src/blocking.rs index 76a4b92..2ffca70 100644 --- a/src/blocking.rs +++ b/src/blocking.rs @@ -625,8 +625,6 @@ mod tests { fn test_feedback() -> Result<()> { let client = Gorse::new(ENTRY_POINT, API_KEY); let all_feedback = vec![ - Feedback::new("read", "10", "3", "2022-11-20T13:55:27Z"), - Feedback::new("read", "10", "4", "2022-11-20T13:55:27Z"), Feedback::new("read", "1000", "300", "2022-11-20T13:55:27Z"), Feedback::new("read", "1000", "400", "2022-11-20T13:55:27Z"), ]; @@ -653,10 +651,14 @@ mod tests { assert_eq!(rows_affected.row_affected, 2); // List feedback. let return_feedback = client.list_feedback(&CursorQuery::new())?; - assert_eq!(return_feedback, all_feedback); + assert!(all_feedback + .iter() + .all(|feedback| return_feedback.contains(feedback))); // List feedback by type. let return_feedback = client.list_feedback_by_type("read", &CursorQuery::new())?; - assert_eq!(return_feedback, all_feedback); + assert!(all_feedback + .iter() + .all(|feedback| return_feedback.contains(feedback))); // Get feedback. let return_feedback = client.get_feedback("read", "1000", "300")?; assert_eq!(return_feedback, feedback[0]);