2025-04-03 04:49:00 +08:00
|
|
|
// NOTE: This module is for tests only and is not included in release builds
|
|
|
|
// The cargo test framework ensures this code only runs during tests
|
|
|
|
|
2025-04-03 04:46:28 +08:00
|
|
|
use database::pool::init_pools;
|
|
|
|
use lazy_static::lazy_static;
|
|
|
|
|
|
|
|
lazy_static! {
|
|
|
|
// Initialize test environment once across all tests
|
|
|
|
static ref TEST_ENV: () = {
|
|
|
|
// Create a runtime for initialization
|
|
|
|
let rt = tokio::runtime::Runtime::new().unwrap();
|
|
|
|
|
|
|
|
// Initialize pools
|
|
|
|
if let Err(e) = rt.block_on(init_pools()) {
|
|
|
|
panic!("Failed to initialize test pools: {}", e);
|
|
|
|
}
|
|
|
|
|
|
|
|
println!("✅ Test environment initialized");
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
// This constructor runs when the test binary loads
|
2025-04-03 04:49:00 +08:00
|
|
|
// It is excluded from non-test builds because the entire 'tests' directory
|
|
|
|
// is only compiled during 'cargo test'
|
2025-04-03 04:46:28 +08:00
|
|
|
#[ctor::ctor]
|
|
|
|
fn init_test_env() {
|
|
|
|
// Force lazy_static initialization
|
|
|
|
lazy_static::initialize(&TEST_ENV);
|
|
|
|
}
|
|
|
|
|
2025-03-19 11:13:47 +08:00
|
|
|
// Test modules
|
2025-04-08 06:03:40 +08:00
|
|
|
pub mod sharing;
|
2025-04-08 06:43:49 +08:00
|
|
|
pub mod metrics;
|
2025-04-08 06:49:24 +08:00
|
|
|
pub mod dashboards;
|
2025-04-08 06:47:00 +08:00
|
|
|
pub mod collections;
|
2025-07-19 01:32:33 +08:00
|
|
|
pub mod chats_list_filter_test;
|