Remove all code comments
This commit is contained in:
parent
8593b861b5
commit
3d0a9a843d
161 changed files with 1208 additions and 1208 deletions
|
|
@ -50,24 +50,24 @@ impl TestConfig {
|
|||
#[must_use]
|
||||
pub const fn full() -> Self {
|
||||
Self {
|
||||
postgres: false, // Botserver will bootstrap its own PostgreSQL
|
||||
minio: false, // Botserver will bootstrap its own MinIO
|
||||
redis: false, // Botserver will bootstrap its own Redis
|
||||
postgres: false,
|
||||
minio: false,
|
||||
redis: false,
|
||||
mock_zitadel: true,
|
||||
mock_llm: true,
|
||||
run_migrations: false, // Let botserver run its own migrations
|
||||
run_migrations: false,
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub const fn auto_install() -> Self {
|
||||
Self {
|
||||
postgres: false, // Botserver will install PostgreSQL
|
||||
minio: false, // Botserver will install MinIO
|
||||
redis: false, // Botserver will install Redis
|
||||
postgres: false,
|
||||
minio: false,
|
||||
redis: false,
|
||||
mock_zitadel: true,
|
||||
mock_llm: true,
|
||||
run_migrations: false, // Botserver handles migrations
|
||||
run_migrations: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -482,9 +482,9 @@ impl BotServerInstance {
|
|||
let botserver_bin_path =
|
||||
std::fs::canonicalize(&botserver_bin).unwrap_or_else(|_| PathBuf::from(&botserver_bin));
|
||||
let botserver_dir = botserver_bin_path
|
||||
.parent() // target/debug
|
||||
.and_then(|p| p.parent()) // target
|
||||
.and_then(|p| p.parent()) // botserver
|
||||
.parent()
|
||||
.and_then(|p| p.parent())
|
||||
.and_then(|p| p.parent())
|
||||
.map(std::path::Path::to_path_buf)
|
||||
.unwrap_or_else(|| {
|
||||
std::fs::canonicalize("../botserver")
|
||||
|
|
@ -514,7 +514,7 @@ impl BotServerInstance {
|
|||
.ok();
|
||||
|
||||
if process.is_some() {
|
||||
let max_wait = 120; // 2 minutes for LLM
|
||||
let max_wait = 120;
|
||||
log::info!("Waiting for botserver to start (max {max_wait}s)...");
|
||||
|
||||
let client = reqwest::Client::builder()
|
||||
|
|
@ -597,9 +597,9 @@ impl BotUIInstance {
|
|||
let botui_bin_path =
|
||||
std::fs::canonicalize(&botui_bin).unwrap_or_else(|_| PathBuf::from(&botui_bin));
|
||||
let botui_dir = botui_bin_path
|
||||
.parent() // target/debug
|
||||
.and_then(|p| p.parent()) // target
|
||||
.and_then(|p| p.parent()) // botui
|
||||
.parent()
|
||||
.and_then(|p| p.parent())
|
||||
.and_then(|p| p.parent())
|
||||
.map(std::path::Path::to_path_buf)
|
||||
.unwrap_or_else(|| {
|
||||
std::fs::canonicalize("../botui").unwrap_or_else(|_| PathBuf::from("../botui"))
|
||||
|
|
@ -694,9 +694,9 @@ impl BotServerInstance {
|
|||
let botserver_bin_path =
|
||||
std::fs::canonicalize(&botserver_bin).unwrap_or_else(|_| PathBuf::from(&botserver_bin));
|
||||
let botserver_dir = botserver_bin_path
|
||||
.parent() // target/release
|
||||
.and_then(|p| p.parent()) // target
|
||||
.and_then(|p| p.parent()) // botserver
|
||||
.parent()
|
||||
.and_then(|p| p.parent())
|
||||
.and_then(|p| p.parent())
|
||||
.map(std::path::Path::to_path_buf)
|
||||
.unwrap_or_else(|| {
|
||||
std::fs::canonicalize("../botserver")
|
||||
|
|
@ -712,13 +712,13 @@ impl BotServerInstance {
|
|||
log::info!("Using installers from: {installers_path:?}");
|
||||
|
||||
let process = std::process::Command::new(&botserver_bin_path)
|
||||
.current_dir(&botserver_dir) // Run from botserver dir to find installers
|
||||
.current_dir(&botserver_dir)
|
||||
.arg("--stack-path")
|
||||
.arg(&stack_path)
|
||||
.arg("--port")
|
||||
.arg(port.to_string())
|
||||
.arg("--noconsole")
|
||||
.env_remove("RUST_LOG") // Remove to avoid logger conflict
|
||||
.env_remove("RUST_LOG")
|
||||
.env("BOTSERVER_INSTALLERS_PATH", &installers_path)
|
||||
.env("DATABASE_URL", ctx.database_url())
|
||||
.env("DIRECTORY_URL", ctx.zitadel_url())
|
||||
|
|
@ -1032,12 +1032,12 @@ mod tests {
|
|||
#[test]
|
||||
fn test_config_full() {
|
||||
let config = TestConfig::full();
|
||||
assert!(!config.postgres); // Botserver handles PostgreSQL
|
||||
assert!(!config.minio); // Botserver handles MinIO
|
||||
assert!(!config.redis); // Botserver handles Redis
|
||||
assert!(!config.postgres);
|
||||
assert!(!config.minio);
|
||||
assert!(!config.redis);
|
||||
assert!(config.mock_zitadel);
|
||||
assert!(config.mock_llm);
|
||||
assert!(!config.run_migrations); // Botserver handles migrations
|
||||
assert!(!config.run_migrations);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -652,7 +652,7 @@ mod tests {
|
|||
assert!(json.contains("access_token"));
|
||||
assert!(json.contains("Bearer"));
|
||||
assert!(json.contains("refresh_token"));
|
||||
assert!(!json.contains("id_token")); // Should be skipped when None
|
||||
assert!(!json.contains("id_token"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -386,8 +386,8 @@ unix_socket_directories = '{}'
|
|||
&self.username,
|
||||
"-d",
|
||||
&self.database_name,
|
||||
"-t", // tuples only
|
||||
"-A", // unaligned
|
||||
"-t",
|
||||
"-A",
|
||||
"-c",
|
||||
sql,
|
||||
])
|
||||
|
|
|
|||
|
|
@ -897,7 +897,7 @@ impl Element {
|
|||
}
|
||||
|
||||
pub async fn size(&self) -> Result<(u64, u64)> {
|
||||
Ok((100, 20)) // Default size
|
||||
Ok((100, 20))
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ pub fn browser_config() -> BrowserConfig {
|
|||
BrowserConfig::default()
|
||||
.with_browser(BrowserType::Chrome)
|
||||
.with_debug_port(debug_port)
|
||||
.headless(headless) // false by default = show browser
|
||||
.headless(headless)
|
||||
.with_timeout(Duration::from_secs(30))
|
||||
.with_window_size(1920, 1080)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,13 +186,13 @@ fn test_instr_function() {
|
|||
let engine = create_basic_engine();
|
||||
|
||||
let result: i64 = engine.eval(r#"INSTR("Hello World", "World")"#).unwrap();
|
||||
assert_eq!(result, 7); // 1-based index
|
||||
assert_eq!(result, 7);
|
||||
|
||||
let result: i64 = engine.eval(r#"INSTR("Hello World", "xyz")"#).unwrap();
|
||||
assert_eq!(result, 0); // Not found
|
||||
assert_eq!(result, 0);
|
||||
|
||||
let result: i64 = engine.eval(r#"INSTR("Hello World", "o")"#).unwrap();
|
||||
assert_eq!(result, 5); // First occurrence
|
||||
assert_eq!(result, 5);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -483,7 +483,7 @@ fn test_while_loop() {
|
|||
"#,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(result, 10); // 0 + 1 + 2 + 3 + 4 = 10
|
||||
assert_eq!(result, 10);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -494,7 +494,7 @@ fn test_division_by_zero() {
|
|||
let result = engine.eval::<f64>("10.0 / 0.0");
|
||||
match result {
|
||||
Ok(val) => assert!(val.is_infinite() || val.is_nan()),
|
||||
Err(_) => (), // Division by zero error is also acceptable
|
||||
Err(_) => (),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/attendance/mod.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -7,13 +7,13 @@
|
|||
|
||||
use serde_json;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
||||
fn test_module_exports() {
|
||||
// Test that types are properly exported
|
||||
|
||||
let _config = KeywordConfig::default();
|
||||
let _parser = KeywordParser::new();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/attendance/llm_assist.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
//! Tests for attendance module
|
||||
|
||||
mod attendance_llm_assist;
|
||||
mod attendance;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/compiler/goto_transform.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
@ -87,7 +87,7 @@
|
|||
assert!(has_goto_constructs("start:\nTALK \"hi\"\nGOTO start"));
|
||||
assert!(has_goto_constructs("IF x > 0 THEN GOTO done"));
|
||||
assert!(!has_goto_constructs("TALK \"hello\"\nWAIT 1"));
|
||||
assert!(!has_goto_constructs("ON ERROR GOTO 0")); // This is special, not regular GOTO
|
||||
assert!(!has_goto_constructs("ON ERROR GOTO 0"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -114,7 +114,7 @@
|
|||
fn test_transform_goto_no_goto() {
|
||||
let input = "TALK \"Hello\"\nTALK \"World\"";
|
||||
let output = transform_goto(input);
|
||||
assert_eq!(output, input); // Unchanged
|
||||
assert_eq!(output, input);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/a2a_protocol.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
use serde_json;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/add_bot.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/add_member.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/add_suggestion.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/agent_reflection.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
@ -128,6 +128,6 @@
|
|||
let summary = result.summary();
|
||||
assert!(summary.contains("7.5"));
|
||||
assert!(summary.contains("15"));
|
||||
assert!(summary.contains("2")); // insights count
|
||||
assert!(summary.contains("1")); // improvements count
|
||||
assert!(summary.contains("2"));
|
||||
assert!(summary.contains("1"));
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/arrays/mod.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -49,7 +49,7 @@ use rhai::Dynamic;
|
|||
|
||||
|
||||
fn test_flatten() {
|
||||
// Test flattening logic
|
||||
|
||||
let nested = vec![vec![1, 2], vec![3, 4]];
|
||||
let flat: Vec<i32> = nested.into_iter().flatten().collect();
|
||||
assert_eq!(flat, vec![1, 2, 3, 4]);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/arrays/contains.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
use rhai::Dynamic;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/arrays/push_pop.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/arrays/slice.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
use rhai::Dynamic;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
fn make_test_array() -> Array {
|
||||
vec![
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/arrays/sort.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
use rhai::Dynamic;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/arrays/unique.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
use rhai::Dynamic;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
use rhai::Dynamic;
|
||||
|
||||
#[test]
|
||||
|
|
@ -102,7 +102,7 @@ use rhai::Dynamic;
|
|||
arr.push(Dynamic::from(1_i64));
|
||||
|
||||
let result = unique_array(arr);
|
||||
// "1" (int) and "1" (string) may have same string representation
|
||||
// so behavior depends on Dynamic::to_string() implementation
|
||||
|
||||
|
||||
assert!(result.len() >= 1 && result.len() <= 2);
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/book.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/card.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/clear_kb.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
use rhai::Dynamic;
|
||||
use rhai::Engine;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
@ -16,12 +16,12 @@ use rhai::Engine;
|
|||
fn test_clear_kb_syntax() {
|
||||
let mut engine = Engine::new();
|
||||
|
||||
// Test CLEAR_KB with argument
|
||||
|
||||
assert!(engine
|
||||
.register_custom_syntax(&["CLEAR_KB", "$expr$"], true, |_, _| Ok(Dynamic::UNIT))
|
||||
.is_ok());
|
||||
|
||||
// Test CLEAR_KB without argument
|
||||
|
||||
assert!(engine
|
||||
.register_custom_syntax(&["CLEAR_KB"], true, |_, _| Ok(Dynamic::UNIT))
|
||||
.is_ok());
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/code_sandbox.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/core_functions.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
|
||||
fn test_module_structure() {
|
||||
// This test verifies the module compiles correctly
|
||||
// Actual function tests are in their respective submodules
|
||||
|
||||
|
||||
assert!(true);
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/create_task.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/crm/attendance.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
use botserver::basic::keywords::crm::attendance::create_fallback_tips;
|
||||
use rhai::Map;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/crm/score_lead.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
use rhai::Dynamic;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ use rhai::Dynamic;
|
|||
lead_data.insert("email".into(), Dynamic::from("ceo@company.com"));
|
||||
|
||||
let score = calculate_lead_score(&lead_data, None);
|
||||
assert!(score > 30); // At least CEO bonus
|
||||
assert!(score > 30);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/data_operations.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/datetime/dateadd.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/datetime/extract.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/datetime/now.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/episodic_memory.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
use serde_json;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
@ -41,11 +41,11 @@ use serde_json;
|
|||
|
||||
|
||||
fn test_extract_json() {
|
||||
// Test with code block
|
||||
|
||||
let response = "Here's the summary:\n```json\n{\"summary\": \"test\"}\n```\n";
|
||||
assert!(extract_json(response).is_ok());
|
||||
|
||||
// Test with raw JSON
|
||||
|
||||
let response = "The result is {\"summary\": \"test\"}";
|
||||
assert!(extract_json(response).is_ok());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/errors/mod.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
|
|||
|
|
@ -1,23 +1,23 @@
|
|||
//! Unit tests migrated from src/basic/keywords/errors/on_error.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
||||
fn test_error_resume_next_flag() {
|
||||
// Initially should be false
|
||||
|
||||
assert!(!is_error_resume_next_active());
|
||||
|
||||
// Enable it
|
||||
|
||||
set_error_resume_next(true);
|
||||
assert!(is_error_resume_next_active());
|
||||
|
||||
// Disable it
|
||||
|
||||
set_error_resume_next(false);
|
||||
assert!(!is_error_resume_next_active());
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
Err("Test error".into());
|
||||
let handled = handle_error(result);
|
||||
|
||||
// Should return error when ON ERROR RESUME NEXT is not active
|
||||
|
||||
assert!(handled.is_err());
|
||||
}
|
||||
|
||||
|
|
@ -65,10 +65,10 @@
|
|||
Err("Test error".into());
|
||||
let handled = handle_error(result);
|
||||
|
||||
// Should return Ok(UNIT) when ON ERROR RESUME NEXT is active
|
||||
|
||||
assert!(handled.is_ok());
|
||||
assert_eq!(get_last_error(), Some("Test error".to_string()));
|
||||
|
||||
// Cleanup
|
||||
|
||||
set_error_resume_next(false);
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/errors/throw.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -11,6 +11,6 @@
|
|||
|
||||
|
||||
fn test_placeholder() {
|
||||
// Placeholder test - actual functionality is in mod.rs
|
||||
|
||||
assert!(true);
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/file_operations.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
use rhai::Dynamic;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/hear_talk.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
@ -73,7 +73,7 @@
|
|||
|
||||
assert!(validate_menu("Apple", &options).is_valid);
|
||||
assert!(validate_menu("1", &options).is_valid);
|
||||
assert!(validate_menu("ban", &options).is_valid); // Partial match
|
||||
assert!(validate_menu("ban", &options).is_valid);
|
||||
assert!(!validate_menu("Orange", &options).is_valid);
|
||||
}
|
||||
|
||||
|
|
@ -81,8 +81,8 @@
|
|||
|
||||
|
||||
fn test_validate_credit_card() {
|
||||
// Valid Visa test number
|
||||
|
||||
assert!(validate_credit_card("4111 1111 1111 1111").is_valid);
|
||||
// Invalid (fails Luhn)
|
||||
|
||||
assert!(!validate_credit_card("1234567890123456").is_valid);
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/http_operations.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
use rhai::Dynamic;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/human_approval.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
use serde_json;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
@ -56,13 +56,13 @@ use serde_json;
|
|||
"test@example.com",
|
||||
serde_json::json!({}),
|
||||
"Test",
|
||||
Some(1), // 1 second timeout
|
||||
Some(1),
|
||||
None,
|
||||
);
|
||||
|
||||
assert!(!manager.is_expired(&request));
|
||||
|
||||
// Manually set expired time
|
||||
|
||||
request.expires_at = Utc::now() - Duration::seconds(10);
|
||||
assert!(manager.is_expired(&request));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/import_export.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
use serde_json;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/kb_statistics.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
use serde_json;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/knowledge_graph.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
use serde_json;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/lead_scoring.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
|
||||
fn test_module_structure() {
|
||||
// This test verifies the module compiles correctly
|
||||
// Actual function tests are in the crm/score_lead.rs module
|
||||
|
||||
|
||||
assert!(true);
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/llm_macros.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/math/abs.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/math/aggregate.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/math/basic_math.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/math/minmax.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/math/random.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/math/round.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/math/trig.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/mcp_directory.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/messaging/send_template.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
use rhai::Dynamic;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/model_routing.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/on_change.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/on_email.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/play.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/procedures.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
use rhai::Dynamic;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
fn setup() {
|
||||
clear_procedures();
|
||||
|
|
@ -29,13 +29,13 @@ y = 2
|
|||
|
||||
let result = preprocess_subs(input);
|
||||
|
||||
// SUB should be extracted
|
||||
|
||||
assert!(!result.contains("SUB MySub"));
|
||||
assert!(!result.contains("END SUB"));
|
||||
assert!(result.contains("x = 1"));
|
||||
assert!(result.contains("y = 2"));
|
||||
|
||||
// Procedure should be registered
|
||||
|
||||
assert!(has_procedure("MYSUB"));
|
||||
let proc = get_procedure("MYSUB").unwrap();
|
||||
assert_eq!(proc.params.len(), 2);
|
||||
|
|
@ -57,12 +57,12 @@ result = Add(1, 2)
|
|||
|
||||
let result = preprocess_functions(input);
|
||||
|
||||
// FUNCTION should be extracted
|
||||
|
||||
assert!(!result.contains("FUNCTION Add"));
|
||||
assert!(!result.contains("END FUNCTION"));
|
||||
assert!(result.contains("result = Add(1, 2)"));
|
||||
|
||||
// Procedure should be registered
|
||||
|
||||
assert!(has_procedure("ADD"));
|
||||
let proc = get_procedure("ADD").unwrap();
|
||||
assert!(proc.is_function);
|
||||
|
|
@ -93,7 +93,7 @@ END SUB
|
|||
fn test_preprocess_call() {
|
||||
setup();
|
||||
|
||||
// First register a SUB
|
||||
|
||||
let sub_input = r#"
|
||||
SUB Greet(name)
|
||||
TALK "Hello " + name
|
||||
|
|
@ -101,11 +101,11 @@ END SUB
|
|||
"#;
|
||||
preprocess_subs(sub_input);
|
||||
|
||||
// Then preprocess CALL
|
||||
|
||||
let call_input = "CALL Greet(\"World\")";
|
||||
let result = preprocess_calls(call_input);
|
||||
|
||||
// Should contain parameter assignment and body
|
||||
|
||||
assert!(result.contains("let name = \"World\""));
|
||||
assert!(result.contains("TALK \"Hello \" + name"));
|
||||
}
|
||||
|
|
@ -165,17 +165,17 @@ total = Calculate(5, 3)
|
|||
|
||||
let result = preprocess_procedures(input);
|
||||
|
||||
// Should have inlined the CALL
|
||||
|
||||
assert!(result.contains("let name = \"User\""));
|
||||
assert!(result.contains("let greeting = \"Hello\""));
|
||||
|
||||
// Original definitions should be gone
|
||||
|
||||
assert!(!result.contains("SUB SendGreeting"));
|
||||
assert!(!result.contains("END SUB"));
|
||||
assert!(!result.contains("FUNCTION Calculate"));
|
||||
assert!(!result.contains("END FUNCTION"));
|
||||
|
||||
// Both should be registered
|
||||
|
||||
assert!(has_procedure("SENDGREETING"));
|
||||
assert!(has_procedure("CALCULATE"));
|
||||
}
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
//! Unit tests migrated from src/basic/keywords/qrcode.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
||||
fn test_qr_code_generation() {
|
||||
// Create a mock state and user for testing
|
||||
// In real tests, you'd set up proper test fixtures
|
||||
|
||||
|
||||
let result = QrCode::new(b"https://example.com");
|
||||
assert!(result.is_ok());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
//! Unit tests migrated from src/basic/keywords/remember.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
||||
fn test_parse_duration() {
|
||||
// Test various duration formats
|
||||
|
||||
assert!(parse_duration("30 days").is_ok());
|
||||
assert!(parse_duration("1 hour").is_ok());
|
||||
assert!(parse_duration("forever").is_ok());
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/save_from_unstructured.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/send_mail.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/send_template.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
|
||||
fn test_module_structure() {
|
||||
// This test verifies the module compiles correctly
|
||||
// Actual function tests are in the messaging/send_template.rs module
|
||||
|
||||
|
||||
assert!(true);
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/set_schedule.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
@ -200,5 +200,5 @@
|
|||
|
||||
fn test_invalid_input() {
|
||||
assert!(parse_natural_schedule("potato salad").is_err());
|
||||
assert!(parse_natural_schedule("every 100 minutes").is_err()); // > 59
|
||||
assert!(parse_natural_schedule("every 100 minutes").is_err());
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/sms.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/social/get_metrics.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/social_media.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
|
||||
fn test_module_structure() {
|
||||
// This test verifies the module compiles correctly
|
||||
// Actual function tests are in the social/ module files
|
||||
|
||||
|
||||
assert!(true);
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/social/post_to_scheduled.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/string_functions.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
use botserver::basic::keywords::string_functions::{instr_impl, is_numeric_impl};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/switch_case.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
use rhai::Dynamic;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/table_definition.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/transfer_to_human.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
@ -42,22 +42,22 @@
|
|||
},
|
||||
];
|
||||
|
||||
// Find by exact name
|
||||
|
||||
let found = find_attendant(&attendants, Some("John Smith"), None);
|
||||
assert!(found.is_some());
|
||||
assert_eq!(found.unwrap().id, "att-001");
|
||||
|
||||
// Find by partial name
|
||||
|
||||
let found = find_attendant(&attendants, Some("john"), None);
|
||||
assert!(found.is_some());
|
||||
assert_eq!(found.unwrap().id, "att-001");
|
||||
|
||||
// Find by alias
|
||||
|
||||
let found = find_attendant(&attendants, Some("johnny"), None);
|
||||
assert!(found.is_some());
|
||||
assert_eq!(found.unwrap().id, "att-001");
|
||||
|
||||
// Find by department
|
||||
|
||||
let found = find_attendant(&attendants, None, Some("customer-service"));
|
||||
assert!(found.is_some());
|
||||
assert_eq!(found.unwrap().id, "att-002");
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/use_account.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/use_kb.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -8,15 +8,15 @@
|
|||
use rhai::Dynamic;
|
||||
use rhai::Engine;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
||||
fn test_use_kb_syntax() {
|
||||
let mut engine = Engine::new();
|
||||
// This would normally use real state and session
|
||||
// For now just test that the syntax can be registered
|
||||
|
||||
|
||||
assert!(engine
|
||||
.register_custom_syntax(&["USE_KB", "$expr$"], true, |_, _| Ok(Dynamic::UNIT))
|
||||
.is_ok());
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/use_website.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
use rhai::Dynamic;
|
||||
use rhai::Engine;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
@ -30,12 +30,12 @@ use rhai::Engine;
|
|||
fn test_use_website_syntax() {
|
||||
let mut engine = Engine::new();
|
||||
|
||||
// Test USE_WEBSITE with argument
|
||||
|
||||
assert!(engine
|
||||
.register_custom_syntax(&["USE_WEBSITE", "$expr$"], true, |_, _| Ok(Dynamic::UNIT))
|
||||
.is_ok());
|
||||
|
||||
// Test CLEAR_WEBSITES without argument
|
||||
|
||||
assert!(engine
|
||||
.register_custom_syntax(&["CLEAR_WEBSITES"], true, |_, _| Ok(Dynamic::UNIT))
|
||||
.is_ok());
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/user_memory.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/validation/isempty.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
use rhai::Dynamic;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
use rhai::{Array, Map};
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/validation/isnull.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/validation/nvl_iif.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/validation/str_val.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/validation/typeof_check.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
use rhai::Dynamic;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/basic/keywords/weather.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//! Unit tests migrated from src/basic/keywords/webhook.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
use rhai::Dynamic;
|
||||
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//! Tests for basic module
|
||||
|
||||
mod basic_compiler_goto_transform;
|
||||
mod basic_keywords_a2a_protocol;
|
||||
mod basic_keywords_add_bot;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/calendar/mod.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
//! Tests for calendar module
|
||||
|
||||
mod calendar;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/compliance/mod.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_compliance_monitor() {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/compliance/code_scanner.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
fn test_pattern_matching() {
|
||||
let scanner = CodeScanner::new("/tmp/test");
|
||||
|
||||
// Test password detection
|
||||
|
||||
let password_pattern = scanner
|
||||
.patterns
|
||||
.iter()
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
assert!(password_pattern.regex.is_match(r#"password = "secret123""#));
|
||||
assert!(password_pattern.regex.is_match(r#"PASSWORD = 'mypass'"#));
|
||||
|
||||
// Test underscore keyword detection
|
||||
|
||||
let underscore_pattern = scanner
|
||||
.patterns
|
||||
.iter()
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
//! Tests for compliance module
|
||||
|
||||
mod compliance_code_scanner;
|
||||
mod compliance;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/console/wizard.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
//! Tests for console module
|
||||
|
||||
mod console_wizard;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/core/bot/manager.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/core/config/model_routing_config.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/core/config/sse_config.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/core/config/user_memory_config.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/core/kb/mod.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
use tempfile::TempDir;
|
||||
|
||||
#[tokio::test]
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
let temp_dir = TempDir::new().unwrap();
|
||||
let manager = KnowledgeBaseManager::new(temp_dir.path());
|
||||
|
||||
// Test that manager is created successfully
|
||||
|
||||
assert!(manager.processor.chunk_size() == 1000);
|
||||
assert!(manager.processor.chunk_overlap() == 200);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/core/kb/document_processor.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
@ -15,20 +15,20 @@
|
|||
.repeat(20);
|
||||
let chunks = processor.create_chunks(&text, Path::new("test.txt"));
|
||||
|
||||
// Verify chunks are created
|
||||
|
||||
assert!(!chunks.is_empty());
|
||||
|
||||
// Verify chunk size
|
||||
|
||||
for chunk in &chunks {
|
||||
assert!(chunk.content.len() <= processor.chunk_size);
|
||||
}
|
||||
|
||||
// Verify overlap exists
|
||||
|
||||
if chunks.len() > 1 {
|
||||
let first_end = &chunks[0].content[chunks[0].content.len().saturating_sub(100)..];
|
||||
let second_start = &chunks[1].content[..100.min(chunks[1].content.len())];
|
||||
|
||||
// There should be some overlap
|
||||
|
||||
assert!(first_end.chars().any(|c| second_start.contains(c)));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
//! Unit tests migrated from src/core/kb/embedding_generator.rs
|
||||
//! These tests were originally in botserver and have been migrated to bottest.
|
||||
|
||||
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
// Original: use super::*; - tests used internal functions from botserver
|
||||
|
||||
|
||||
#[test]
|
||||
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
let text = "This is a test\n\nWith multiple lines";
|
||||
let _generator = EmbeddingGenerator::new("http://localhost:8082".to_string());
|
||||
|
||||
// This would test actual embedding generation if service is available
|
||||
// For unit tests, we just verify the structure is correct
|
||||
|
||||
|
||||
assert!(!text.is_empty());
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue