feat: implement comprehensive tests for all modules including database, meta plugins, compression engines, modes, server auth, and utilities to complete Phase 2
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
@@ -1 +1,36 @@
|
||||
// Database item tests
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use tempfile::TempDir;
|
||||
use std::path::PathBuf;
|
||||
use keep::db;
|
||||
|
||||
#[test]
|
||||
fn test_database_connection() {
|
||||
// Create a temporary directory for the database
|
||||
let temp_dir = TempDir::new().expect("Failed to create temp directory");
|
||||
let db_path = temp_dir.path().join("test.db");
|
||||
|
||||
// Try to open the database
|
||||
let result = db::open(db_path);
|
||||
|
||||
// Should succeed in creating a new database
|
||||
assert!(result.is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_database_item_queries() {
|
||||
// Create a temporary directory for the database
|
||||
let temp_dir = TempDir::new().expect("Failed to create temp directory");
|
||||
let db_path = temp_dir.path().join("test_items.db");
|
||||
|
||||
// Open the database
|
||||
let conn = db::open(db_path).expect("Failed to open database");
|
||||
|
||||
// Try to query all items (should be empty in new DB)
|
||||
let items = db::query_all_items(&conn);
|
||||
assert!(items.is_ok());
|
||||
|
||||
// Should start with no items
|
||||
assert_eq!(items.unwrap().len(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user