fix: mock provider returns today's date in classify response

Without a date, articles are routed to "Articles sans date" instead
of their classified category, breaking pipeline tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
master
oabrivard 3 months ago
parent 20b298b926
commit e444f79c0b

@ -58,10 +58,12 @@ impl LlmProvider for MockLlmProvider {
.map(|l| l.trim_start_matches("Titre : ").to_string()) .map(|l| l.trim_start_matches("Titre : ").to_string())
.unwrap_or_else(|| "Mock Article".to_string()); .unwrap_or_else(|| "Mock Article".to_string());
let today = chrono::Utc::now().format("%Y-%m-%d").to_string();
return Ok(json!({ return Ok(json!({
"title": title, "title": title,
"summary": format!("Mock summary for: {}", title), "summary": format!("Mock summary for: {}", title),
"category": self.default_category, "category": self.default_category,
"date": today,
"is_article": true, "is_article": true,
})); }));
} }
@ -96,6 +98,7 @@ mod tests {
assert_eq!(result["title"], "GPT-7"); assert_eq!(result["title"], "GPT-7");
assert_eq!(result["category"], "AI News"); assert_eq!(result["category"], "AI News");
assert_eq!(result["is_article"], true); assert_eq!(result["is_article"], true);
assert!(result["date"].as_str().is_some_and(|d| !d.is_empty()), "date should be set");
} }
#[tokio::test] #[tokio::test]

Loading…
Cancel
Save