- Remove unused thiserror dependency from Cargo.toml - Remove unused imports (Text, Tabs, Widget, Event, KeyCode, KeyEventKind) from tui/mod.rs - Remove unused imports (File, Write) from export/mod.rs - Remove unused pub use ComplexityDistribution from core/analyzer.rs
53 lines
1.5 KiB
Rust
53 lines
1.5 KiB
Rust
use std::path::PathBuf;
|
|
|
|
use techdebt_tracker_cli::models::{Priority, TechDebtItem, FileLocation};
|
|
|
|
#[test]
|
|
fn test_priority_from_keyword() {
|
|
assert_eq!(Priority::from_keyword("FIXME"), Priority::Critical);
|
|
assert_eq!(Priority::from_keyword("BUG"), Priority::Critical);
|
|
assert_eq!(Priority::from_keyword("TODO"), Priority::Medium);
|
|
assert_eq!(Priority::from_keyword("HACK"), Priority::Low);
|
|
assert_eq!(Priority::from_keyword("XXX"), Priority::High);
|
|
assert_eq!(Priority::from_keyword("NOTE"), Priority::Low);
|
|
}
|
|
|
|
#[test]
|
|
fn test_priority_ordering() {
|
|
assert!(Priority::Critical > Priority::High);
|
|
assert!(Priority::High > Priority::Medium);
|
|
assert!(Priority::Medium > Priority::Low);
|
|
assert!(Priority::Low < Priority::Critical);
|
|
}
|
|
|
|
#[test]
|
|
fn test_priority_as_str() {
|
|
assert_eq!(Priority::Critical.as_str(), "Critical");
|
|
assert_eq!(Priority::High.as_str(), "High");
|
|
assert_eq!(Priority::Medium.as_str(), "Medium");
|
|
assert_eq!(Priority::Low.as_str(), "Low");
|
|
}
|
|
|
|
#[test]
|
|
fn test_tech_debt_item_creation() {
|
|
let location = FileLocation {
|
|
path: PathBuf::from("/test/file.rs"),
|
|
line: 10,
|
|
column: 5,
|
|
end_line: None,
|
|
end_column: None,
|
|
};
|
|
|
|
let item = TechDebtItem::new(
|
|
"FIXME".to_string(),
|
|
"This is a test fixme".to_string(),
|
|
location,
|
|
"Rust".to_string(),
|
|
techdebt_tracker_cli::models::CommentType::SingleLine,
|
|
);
|
|
|
|
assert_eq!(item.keyword, "FIXME");
|
|
assert_eq!(item.priority, Priority::Critical);
|
|
assert!(!item.id.is_empty());
|
|
}
|