refactor(service): remove useless comments

This commit is contained in:
2025-08-10 17:46:34 +02:00
parent fd9a1114b9
commit a9149178d4

View File

@@ -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<dyn std::error::Error>> {
// 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<dyn std::error::Error>> {
// 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()));