#[cfg(test)]
mod tests {
    use crate::db;
    use crate::db::Tag;
    use crate::tests::common::test_helpers::{create_temp_db, create_test_item};

    #[test]
    fn test_database_tag_operations() {
        // Create a temporary database
        let (_temp_dir, conn, _db_path) = create_temp_db();

        // First insert an item to have a valid ID
        let item_id = create_test_item(&conn);

        // Create a test tag with the valid item ID
        let tag = Tag {
            id: item_id,
            name: "test_tag".to_string(),
        };

        // Try to insert tag
        let insert_result = db::insert_tag(&conn, tag.clone());
        assert!(insert_result.is_ok());
    }

    #[test]
    fn test_database_item_tag_operations() {
        // Create a temporary database
        let (_temp_dir, conn, _db_path) = create_temp_db();

        // Try to delete tags for non-existent item
        let item = crate::db::Item {
            id: Some(999), // Non-existent item
            ts: chrono::Utc::now(),
            size: Some(0),
            compression: crate::compression_engine::CompressionType::None.to_string(),
        };

        let delete_result = db::delete_item_tags(&conn, item);
        assert!(delete_result.is_ok());
    }
}
