Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushuo committed Feb 2, 2024
1 parent e636da2 commit c7fc7cc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"name": "Debug",
"program": "${workspaceFolder}/backend/target/debug/backend",
"args": [],
"cwd": "${workspaceFolder}/backend"
"cwd": "${workspaceFolder}/backend",
"envFile": "${workspaceFolder}/backend/.env"
},
{
"type": "chrome",
Expand Down
8 changes: 8 additions & 0 deletions backend/src/test/plantings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::ops::Add;
use actix_http::StatusCode;
use actix_web::{http::header, test};
use chrono::{Days, NaiveDate, Utc};
use diesel::ExpressionMethods;
use diesel_async::{scoped_futures::ScopedFutureExt, RunQueryDsl};
use uuid::Uuid;

Expand Down Expand Up @@ -417,6 +418,13 @@ async fn test_removed_planting_inside_loading_offset_is_in_timeline() {
})
.execute(conn)
.await?;

// Add date default is set to current date, so we need to remove it
diesel::update(crate::schema::plantings::table)
.set(crate::schema::plantings::add_date.eq(None::<NaiveDate>))
.execute(conn)
.await?;

Ok(())
}
.scope_boxed()
Expand Down
1 change: 1 addition & 0 deletions backend/src/test/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ pub async fn init_test_app(
String,
impl Service<Request, Response = ServiceResponse<impl MessageBody>, Error = Error>,
) {
let _ = env_logger::try_init();
let app = init_test_app_impl(pool).await;
let token = setup_auth();

Expand Down

0 comments on commit c7fc7cc

Please sign in to comment.