From a9149178d4c7ec65ad2f6596b3f5637e295bcfbe Mon Sep 17 00:00:00 2001 From: JeremyLARDENOIS Date: Sun, 10 Aug 2025 17:46:34 +0200 Subject: [PATCH] refactor(service): remove useless comments --- src/app/service.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/app/service.rs b/src/app/service.rs index a4c757f..a345db2 100644 --- a/src/app/service.rs +++ b/src/app/service.rs @@ -21,8 +21,8 @@ pub fn new( } impl Service { + /// Check for threshold violations and send alerts pub fn alert_on_threshold_violation(&self) -> Result<(), Box> { - // Check for threshold violations and send alerts let violations = self.monitor.check_thresholds(); for violation in violations { let message = self.formatter.format_violation(violation); @@ -32,8 +32,8 @@ impl Service { Ok(()) } + /// Send a final notification with all system information pub fn send_all_metrics_notification(&self) -> Result<(), Box> { - // Send a final notification with all system information let summary = self.formatter.format_summary(&self.monitor.get_metrics()); self.notifier.send_notification(&summary)?; @@ -56,7 +56,6 @@ mod tests { let mut monitor = MockForMonitoringSystem::new(); let mut formatter = MockForFormattingMessage::new(); - // Set up expectations for the mocks notifier.expect_send_notification().returning(|_| Ok(())); monitor.expect_check_thresholds().returning(|| vec![]); monitor.expect_get_metrics().returning(|| HashMap::new()); @@ -78,7 +77,6 @@ mod tests { let mut monitor = MockForMonitoringSystem::new(); let mut formatter = MockForFormattingMessage::new(); - // Set up expectations for the mocks notifier.expect_send_notification().returning(|_| Ok(())); monitor.expect_check_thresholds().returning(|| vec![]); monitor.expect_get_metrics().returning(|| HashMap::new()); @@ -100,13 +98,11 @@ mod tests { let mut monitor = MockForMonitoringSystem::new(); let mut formatter = MockForFormattingMessage::new(); - // Mock a single violation to trigger notification monitor.expect_check_thresholds().returning(|| { vec![Box::new(crate::app::ports::driven::MockForGettingViolationData::new())] }); formatter.expect_format_violation().returning(|_| "Test violation".to_string()); - // Mock notification failure notifier.expect_send_notification() .returning(|_| Err("Network error".into())); @@ -128,7 +124,6 @@ mod tests { monitor.expect_get_metrics().returning(|| HashMap::new()); formatter.expect_format_summary().returning(|_| "Test summary".to_string()); - // Mock notification failure notifier.expect_send_notification() .returning(|_| Err("Network error".into()));