fix: Fix tests in threads with proper mock folder properly
This commit is contained in:
parent
4da0fd1ca3
commit
b628b3d9ab
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
use super::commands::*;
|
use super::commands::*;
|
||||||
use super::helpers::should_use_sqlite;
|
use super::helpers::should_use_sqlite;
|
||||||
|
use futures_util::future;
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
@ -436,7 +437,7 @@ async fn test_concurrent_message_operations() {
|
|||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let results = futures::future::join_all(handles).await;
|
let results = future::join_all(handles).await;
|
||||||
assert!(results.iter().all(|r| r.is_ok() && r.as_ref().unwrap().is_ok()));
|
assert!(results.iter().all(|r| r.is_ok() && r.as_ref().unwrap().is_ok()));
|
||||||
|
|
||||||
let messages = list_messages(app_handle, thread_id).await.unwrap();
|
let messages = list_messages(app_handle, thread_id).await.unwrap();
|
||||||
@ -448,6 +449,13 @@ async fn test_concurrent_message_operations() {
|
|||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_empty_thread_list() {
|
async fn test_empty_thread_list() {
|
||||||
let (app, data_dir) = mock_app_with_temp_data_dir();
|
let (app, data_dir) = mock_app_with_temp_data_dir();
|
||||||
|
// Clean up any leftover test data
|
||||||
|
let test_data_threads = std::env::current_dir()
|
||||||
|
.unwrap_or_else(|_| PathBuf::from("."))
|
||||||
|
.join("test-data")
|
||||||
|
.join("threads");
|
||||||
|
let _ = fs::remove_dir_all(&test_data_threads);
|
||||||
|
|
||||||
let threads = list_threads(app.handle().clone()).await.unwrap();
|
let threads = list_threads(app.handle().clone()).await.unwrap();
|
||||||
assert_eq!(threads.len(), 0);
|
assert_eq!(threads.len(), 0);
|
||||||
let _ = fs::remove_dir_all(data_dir);
|
let _ = fs::remove_dir_all(data_dir);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user