Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them.
Page: /drakestapleton/spark-inquisitor/blob/main/tests/issue_triage_evaluator.rs
# spark-inquisitor
Ultra-fast compiled native Rust gatekeeper and automated code reviewer
Brought by drakestapleton
Sign in to star 0 stars 0 watching
About Files History Releases Proposed changes Issues For developers
branch `main` Branches Tags History
`spark-inquisitor / tests / issue_triage_evaluator.rs`
118 lines · 4538 bytes Raw Blame History
1 use spark_inquisitor::eval::TestimonyEvaluator;
2 use spark_inquisitor::triage::{triage_issue, IssueCategory};
3
4 #[test]
5 fn test_triage_empty_string_body_and_title() {
6 let result = triage_issue("contributor1", 200, "", "");
7 assert_eq!(result.category, IssueCategory::Inquiry);
8 assert!(result.markdown.contains("Untitled Issue"));
9 assert!(!result.markdown.contains('\u{2014}'));
10 assert!(!result.markdown.contains('\u{2013}'));
11 }
12
13 #[test]
14 fn test_triage_whitespace_only_body() {
15 let result = triage_issue(
16 "contributor2",
17 201,
18 "Need clarification on API",
19 " \n\t \r\n ",
20 );
21 assert_eq!(result.category, IssueCategory::Inquiry);
22 assert!(result.labels.contains(&"question".to_string()));
23 assert!(result.labels.contains(&"triaged".to_string()));
24 }
25
26 #[test]
27 fn test_triage_markdown_injection() {
28 let body = "### Fake Header\n[Malicious Link](javascript:alert(1))\n\n| Table | Injection |\n| --- | --- |\n| a | b |";
29 let result = triage_issue("attacker", 202, "Bug: memory corruption in parser", body);
30 assert_eq!(result.category, IssueCategory::BugReport);
31 assert!(result.markdown.contains("### ⚖️ Sovereign Triage:"));
32 assert!(!result.markdown.contains('\u{2014}'));
33 assert!(!result.markdown.contains('\u{2013}'));
34 }
35
36 #[test]
37 fn test_triage_script_tag_injection() {
38 let title = " Compiler Panic";
39 let body =
40 "