Skip to content

Commit 7d1ee7f

Browse files
committed
test(api): cover connection summary totals
1 parent b9bb8eb commit 7d1ee7f

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

clash-lib/src/app/dispatcher/statistics_manager.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,3 +308,21 @@ pub struct Snapshot {
308308
pub memory: usize,
309309
pub connections: Vec<TrackerInfo>,
310310
}
311+
312+
#[cfg(test)]
313+
mod tests {
314+
use super::StatisticsManager;
315+
316+
#[tokio::test]
317+
async fn summary_reports_accumulated_totals() {
318+
let manager = StatisticsManager::new();
319+
manager.push_uploaded(7);
320+
manager.push_downloaded(11);
321+
322+
let summary = manager.summary().await;
323+
324+
assert_eq!(summary.upload_total, 7);
325+
assert_eq!(summary.download_total, 11);
326+
assert_eq!(summary.connection_count, 0);
327+
}
328+
}

0 commit comments

Comments
 (0)