From 2f8a701c95856248a282cfc6b178615b82f65f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E7=8E=AE=20=28Jade=20Lin=29?= Date: Fri, 13 Sep 2024 22:42:41 +0800 Subject: [PATCH] Fix trivials --- scripts/cli.sh | 14 +++++++++++--- src/api/folder.rs | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/cli.sh b/scripts/cli.sh index 55a44d3..37cdd31 100755 --- a/scripts/cli.sh +++ b/scripts/cli.sh @@ -52,13 +52,17 @@ main() { if [[ -z "${CI-}" ]]; then echo ">>> Setting up the project development environment" docker compose up -d --wait + echo "DATABASE_URL=postgres://postgres:example@${POSTGRES_HOST-localhost}:${POSTGRES_PORT-5432}/${POSTGRES_DB-bearmark}" >.env + echo ">>> Setting up database" + ./scripts/bin/diesel migration run else echo ">>> Skip setting up the project development environment" + echo "DATABASE_URL=postgres://postgres:example@${POSTGRES_HOST-db}:${POSTGRES_PORT-5432}/${POSTGRES_DB-bearmark}" >.env + echo ">>> Setting up database" + diesel migration run fi - echo ">>> Setting up database" - ./scripts/bin/diesel migration run echo ">>> Done" ;; "teardown") @@ -80,7 +84,11 @@ main() { ;; "coverage") echo ">>> Running tests with coverage" - ./scripts/bin/cargo-tarpaulin --out html --skip-clean -- --show-output --test-threads 1 "$@" + if [[ -z "${CI-}" ]]; then + ./scripts/bin/cargo-tarpaulin --out html --skip-clean -- --show-output --test-threads 1 "$@" + else + cargo tarpaulin --out html --skip-clean -- --show-output --test-threads 1 "$@" + fi echo "open file ./tarpaulin-report.html to see coverage report" cleanup_profraw_files ;; diff --git a/src/api/folder.rs b/src/api/folder.rs index 784d503..3a830bf 100644 --- a/src/api/folder.rs +++ b/src/api/folder.rs @@ -215,7 +215,7 @@ pub(crate) mod test { let res = client.get(uri!(super::list_folders(cwd = _))).dispatch(); assert_eq!(res.status(), Status::Ok); let folders: Vec = res.into_json().unwrap(); - assert!(folders.is_empty()); + assert!(!folders.is_empty()); assert!(folders.iter().any(|f| f.path == parent_path)); assert!(folders.iter().all(|f| f.path != path));