fix(notification): ensure BuildNotificationList returns an empty slice instead of nil

This commit is contained in:
mlogclub
2026-04-28 23:09:50 +08:00
parent 28d1cfc160
commit bcd2c603f4
2 changed files with 18 additions and 3 deletions
@@ -0,0 +1,18 @@
package builders
import (
"testing"
"cs-agent/internal/models"
)
func TestBuildNotificationListReturnsEmptySlice(t *testing.T) {
results := BuildNotificationList([]models.Notification{})
if results == nil {
t.Fatalf("expected empty slice, got nil")
}
if len(results) != 0 {
t.Fatalf("expected empty slice, got %d items", len(results))
}
}