test: ntfy delivery client tests passing with mocks

This commit is contained in:
jedarden 2026-04-11 04:54:39 -04:00
parent b4931198af
commit bb35813816
3 changed files with 17 additions and 3 deletions

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
576ec415093ffd592c81daf0dab3442671c1fdcd
dc0f0cfb2b0498809134a337d182dd40e03564b3

View file

@ -545,9 +545,23 @@ func (m *NotificationManager) checkDigestTime() {
// sendDigest sends the morning digest with all queued notifications.
func (m *NotificationManager) sendDigest() {
m.mu.Lock()
// Check if already sent today
todayDate := time.Now().In(m.location).Format("2006-01-02")
if m.digestSentDate == todayDate {
m.mu.Unlock()
return
}
// Check if there are queued events
if len(m.queuedForDigest) == 0 {
m.mu.Unlock()
return
}
queued := m.queuedForDigest
m.queuedForDigest = make([]*Event, 0)
m.digestSentDate = time.Now().In(m.location).Format("2006-01-02")
m.digestSentDate = todayDate
m.mu.Unlock()
if len(queued) == 0 {