From fdd7525e5a0d298ebb8a9aa81cc19ec79e8cd113 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Thu, 17 Nov 2022 21:20:09 +0100 Subject: added --clean for update && list downloadfolder --- tests/db.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/db.rs b/tests/db.rs index 16061d0..7127fc6 100644 --- a/tests/db.rs +++ b/tests/db.rs @@ -1,4 +1,4 @@ -use std::{fs::{File, create_dir_all}, path::Path, sync::Once}; +use std::{fs::{File, create_dir_all, remove_dir_all}, path::Path, sync::Once}; use modlist::{config::{Cfg, Apis}, db::{mods_insert, db_setup, mods_get_all_ids, mods_get_id, mods_remove, userlist_insert, lists_insert, userlist_get_all_ids, userlist_remove, mods_get_versions, userlist_get_applicable_versions, lists_remove, lists_get, lists_get_all_ids, userlist_get_all_current_version_ids, userlist_change_versions, s_userlist_update_download, userlist_get_all_downloads, config_change_current_list, config_get_current_list, s_config_update_version, s_config_create_version, s_config_get_version}, Modloader, List}; @@ -11,6 +11,7 @@ fn setup() -> Cfg { INIT.call_once(|| { let db_path = Path::new(db_pathstr); + if db_path.exists() { remove_dir_all(db_pathstr).unwrap(); }; create_dir_all(db_path).unwrap(); let db_filestr = format!("{}/data.db", db_pathstr); File::create(db_filestr).unwrap(); @@ -46,7 +47,7 @@ fn test_mods_get_all_ids() { fn test_mods_get_id() { let config = setup(); - mods_insert(config.clone(), String::from("GI"), String::from("GETID_TEST"), vec![String::from("GI_VER1"), String::from("GI_VER2")]).unwrap(); + mods_insert(config, String::from("GI"), String::from("GETID_TEST"), vec![String::from("GI_VER1"), String::from("GI_VER2")]).unwrap(); } #[test] -- cgit v1.2.3