Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions crates/terraphim_merge_coordinator/src/gitea.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,22 @@ mod tests {

#[test]
fn open_prs_limit_exceeds_gitea_default_of_50() {
assert!(
OPEN_PRS_LIMIT > 50,
"OPEN_PRS_LIMIT must exceed 50 so PRs beyond position 50 are not silently dropped"
);
const {
assert!(
OPEN_PRS_LIMIT > 50,
"OPEN_PRS_LIMIT must exceed 50 so PRs beyond position 50 are not silently dropped"
)
}
}

#[test]
fn open_prs_limit_within_gitea_max_page_size() {
assert!(
OPEN_PRS_LIMIT <= 300,
"Gitea max page size is 300; limit must not exceed it"
);
const {
assert!(
OPEN_PRS_LIMIT <= 300,
"Gitea max page size is 300; limit must not exceed it"
)
}
}

#[test]
Expand Down
3 changes: 1 addition & 2 deletions crates/terraphim_validation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ mod tests {

#[tokio::test]
async fn test_validation_system_creation() {
let system = ValidationSystem::new().unwrap();
assert!(true); // Basic creation test
let _system = ValidationSystem::new().unwrap();
}
}
9 changes: 5 additions & 4 deletions crates/terraphim_weather_report/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,11 @@ fn print_tier_markdown(tier: &terraphim_weather_report::TierSection) {
"| {} | {} | `{}` | {} | {} | {} |",
cond, m.provider, m.model, m.cli, latency, cost
);
if let Some(detail) = &m.detail {
if !detail.is_empty() && !detail.starts_with("probe skipped") {
println!("| | | | | | *{}* |", detail.replace('|', "\\|"));
}
if let Some(detail) = &m.detail
&& !detail.is_empty()
&& !detail.starts_with("probe skipped")
{
println!("| | | | | | *{}* |", detail.replace('|', "\\|"));
}
}
println!();
Expand Down
66 changes: 33 additions & 33 deletions terraphim_server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,39 @@ async fn not_found() -> Response {
(StatusCode::NOT_FOUND, "404").into_response()
}

/// Constructs a minimal Axum router suitable for integration tests.
pub async fn build_router_for_tests() -> Router {
use terraphim_config::ConfigBuilder;

// Create minimal test configuration
let mut config = ConfigBuilder::new()
.build_default_embedded()
.build()
.expect("Failed to build test config");

let config_state = ConfigState::new(&mut config)
.await
.expect("Failed to create ConfigState");

let (tx, _rx) = channel::<IndexedDocument>(10);

// Initialize summarization manager
let summarization_manager = Arc::new(SummarizationManager::new(QueueConfig::default()));

// Initialize workflow management components for tests
let workflow_sessions = Arc::new(RwLock::new(HashMap::new()));
let (websocket_broadcaster, _) = broadcast::channel(100);

// Create extended application state for tests
let app_state = AppState {
config_state,
workflow_sessions,
websocket_broadcaster,
};

build_router(app_state, tx, summarization_manager, false)
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down Expand Up @@ -860,36 +893,3 @@ mod tests {
assert!(!desc.is_empty());
}
}

/// Constructs a minimal Axum router suitable for integration tests.
pub async fn build_router_for_tests() -> Router {
use terraphim_config::ConfigBuilder;

// Create minimal test configuration
let mut config = ConfigBuilder::new()
.build_default_embedded()
.build()
.expect("Failed to build test config");

let config_state = ConfigState::new(&mut config)
.await
.expect("Failed to create ConfigState");

let (tx, _rx) = channel::<IndexedDocument>(10);

// Initialize summarization manager
let summarization_manager = Arc::new(SummarizationManager::new(QueueConfig::default()));

// Initialize workflow management components for tests
let workflow_sessions = Arc::new(RwLock::new(HashMap::new()));
let (websocket_broadcaster, _) = broadcast::channel(100);

// Create extended application state for tests
let app_state = AppState {
config_state,
workflow_sessions,
websocket_broadcaster,
};

build_router(app_state, tx, summarization_manager, false)
}