Skip to content

Commit

Permalink
fix: feedback test not passing sometimes
Browse files Browse the repository at this point in the history
  • Loading branch information
Aytixel committed Jul 16, 2024
1 parent 33417a0 commit b2814a8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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]);
Expand Down
10 changes: 6 additions & 4 deletions src/blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
];
Expand All @@ -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]);
Expand Down

0 comments on commit b2814a8

Please sign in to comment.