fixed Unit-Test and added void for to async methods

This commit is contained in:
Vito0912 2025-05-17 18:20:15 +02:00
parent dc41ccc377
commit 64fa48981e
No known key found for this signature in database
GPG Key ID: 29A3D509FE70B237

View File

@ -43,7 +43,7 @@ class NotificationManager {
episodeSubtitle: episode.subtitle || '',
episodeDescription: episode.description || ''
}
this.triggerNotification('onPodcastEpisodeDownloaded', eventData)
void this.triggerNotification('onPodcastEpisodeDownloaded', eventData)
}
/**
@ -68,7 +68,7 @@ class NotificationManager {
backupCount: totalBackupCount || 'Invalid',
removedOldest: removedOldest || 'false'
}
this.triggerNotification('onBackupCompleted', eventData)
void this.triggerNotification('onBackupCompleted', eventData)
}
/**
@ -87,11 +87,11 @@ class NotificationManager {
const eventData = {
errorMsg: errorMsg || 'Backup failed'
}
this.triggerNotification('onBackupFailed', eventData)
void this.triggerNotification('onBackupFailed', eventData)
}
onTest() {
this.triggerNotification('onTest')
void this.triggerNotification('onTest')
}
/**
@ -157,7 +157,7 @@ class NotificationManager {
if (this.notificationQueue.length) {
// Send next notification in queue
const nextNotificationEvent = this.notificationQueue.shift()
this.triggerNotification(nextNotificationEvent.eventName, nextNotificationEvent.eventData)
void this.triggerNotification(nextNotificationEvent.eventName, nextNotificationEvent.eventData)
}
}, Database.notificationSettings.notificationDelay)
}
@ -187,14 +187,14 @@ class NotificationManager {
}
fireNotificationFromSocket(eventName, eventData) {
if (!Database.notificationSettings.isUseable) return
if (!Database.notificationSettings || !Database.notificationSettings.isUseable) return
const eventNameModified = eventName.replace(/_([a-z])/g, (_, c) => c.toUpperCase())
const eventKey = `on${eventNameModified.charAt(0).toUpperCase()}${eventNameModified.slice(1)}`
if (!Database.notificationSettings.getHasActiveNotificationsForEvent(eventKey)) {
// No logging to prevent console spam
Logger.debug(`[NotificationManager] fireSocketNotification: No active notifications`)
//Logger.debug(`[NotificationManager] fireSocketNotification: No active notifications`)
return
}