Skip to content

fix: add fallback icons for notifications #17013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Mar 28, 2025
Prev Previous commit
Next Next commit
improve tests
  • Loading branch information
defelmnq committed Mar 27, 2025
commit d22f0b56e23a88ef4ad285e33987e1a563f89cdc
28 changes: 17 additions & 11 deletions coderd/inboxnotifications_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,8 @@ func TestInboxNotifications_MarkAllAsRead(t *testing.T) {
}

func TestInboxNotifications_SetInboxNotificationIcon(t *testing.T) {
t.Parallel()

tests := []struct {
name string
icon string
Expand Down Expand Up @@ -913,17 +915,21 @@ func TestInboxNotifications_SetInboxNotificationIcon(t *testing.T) {
for _, tt := range tests {
tt := tt

notif := codersdk.InboxNotification{
ID: uuid.New(),
UserID: uuid.New(),
TemplateID: tt.templateID,
Title: "notification title",
Content: "notification content",
Icon: tt.icon,
CreatedAt: time.Now(),
}
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

coderd.SetInboxNotificationIcon(&notif)
require.Equal(t, tt.expectedIcon, notif.Icon)
notif := codersdk.InboxNotification{
ID: uuid.New(),
UserID: uuid.New(),
TemplateID: tt.templateID,
Title: "notification title",
Content: "notification content",
Icon: tt.icon,
CreatedAt: time.Now(),
}

coderd.SetInboxNotificationIcon(&notif)
require.Equal(t, tt.expectedIcon, notif.Icon)
})
}
}
Loading