mirror of
https://github.com/MeshCore-Beacon/beacon-server.git
synced 2026-12-06 08:34:42 +00:00
Alerts go out by email, by push or both, as each user chooses. Push is sent through the push server with the operator's Push ID and secret and sealed per device, so this server no longer holds a Firebase key. The outbox tracks each channel, so a retry of one never repeats the other.
23 lines
652 B
Go
23 lines
652 B
Go
// Copyright 2026 Beacon Contributors
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
package background
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/MeshCore-Beacon/beacon-server/internal/alerts"
|
|
)
|
|
|
|
func TestAlertTasks(t *testing.T) {
|
|
if tasks := AlertTasks(nil, nil); len(tasks) != 0 {
|
|
t.Fatalf("tasks without a sender: %+v", tasks)
|
|
}
|
|
tasks := AlertTasks(nil, alerts.NewSender(nil, alerts.SenderConfig{}))
|
|
if len(tasks) != 2 || tasks[0].Name != "alerts_eval" || tasks[0].Interval != 5*time.Minute || tasks[0].Run == nil ||
|
|
tasks[1].Name != "alerts_send" || tasks[1].Interval != time.Minute || tasks[1].Run == nil {
|
|
t.Fatalf("%+v", tasks)
|
|
}
|
|
}
|