Skip to content

Commit

Permalink
test(filemanager): refactor tests to use helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalenic committed Jul 11, 2024
1 parent 35c8dc1 commit af85271
Show file tree
Hide file tree
Showing 7 changed files with 258 additions and 713 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,27 +60,27 @@ mod tests {
#[sqlx::test(migrator = "MIGRATOR")]
async fn test_get_object(pool: PgPool) {
let client = Client::from_pool(pool);
let entries = initialize_database(&client, 10).await;
let entries = initialize_database(&client, 10).await.objects;

let first = entries.first().unwrap();
let builder = GetQueryBuilder::new(&client);
let result = builder.get_object(first.0.object_id).await.unwrap();
let result = builder.get_object(first.object_id).await.unwrap();

assert_eq!(result.as_ref(), Some(&first.0));
assert_eq!(result.as_ref(), Some(first));
}

#[sqlx::test(migrator = "MIGRATOR")]
async fn test_list_s3_objects(pool: PgPool) {
let client = Client::from_pool(pool);
let entries = initialize_database(&client, 10).await;
let entries = initialize_database(&client, 10).await.s3_objects;

let first = entries.first().unwrap();
let builder = GetQueryBuilder::new(&client);
let result = builder
.get_s3_object_by_id(first.1.s3_object_id)
.get_s3_object_by_id(first.s3_object_id)
.await
.unwrap();

assert_eq!(result.as_ref(), Some(&first.1));
assert_eq!(result.as_ref(), Some(first));
}
}
Loading

0 comments on commit af85271

Please sign in to comment.