tests: Operation tests

This commit is contained in:
Black_Raven committed 2026-03-27 12:09:02 +03:00
1 parent a07396c576
commit 53bc624b02
1 file changed
+29
+29
View File
@@ -0,0 +1,29 @@
use crate::operations::{FileInfo, SyncStats};
#[test]
fn test_file_info_formatting() {
let file = FileInfo {
name: "test.txt".to_string(),
path: "/path/test.txt".to_string(),
size: 1500,
is_dir: false,
modified: None,
};
assert_eq!(file.format_size(), "1.5 KB");
assert_eq!(file.icon(), "📄");
}
#[test]
fn test_sync_stats_formatting() {
let stats = SyncStats {
transferred: 1024,
files: 10,
errors: 0,
checks: 100,
elapsed_time: 5.0,
transfer_speed: 2_500_000.0, // Добавлен .0 для f64
};
assert_eq!(stats.format_speed(), "2.4 MB/s");
}