Skip to content

Commit c1d5a00

Browse files
committed
add test for push notifications being enabled
1 parent 62b6b8d commit c1d5a00

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

coderd/notifications_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"slices"
77
"testing"
88

9+
"github.com/stretchr/testify/assert"
910
"github.com/stretchr/testify/require"
1011

1112
"github.com/coder/serpent"
@@ -14,6 +15,7 @@ import (
1415
"github.com/coder/coder/v2/coderd/database"
1516
"github.com/coder/coder/v2/coderd/notifications"
1617
"github.com/coder/coder/v2/coderd/notifications/notificationstest"
18+
"github.com/coder/coder/v2/coderd/notifications/push"
1719
"github.com/coder/coder/v2/codersdk"
1820
"github.com/coder/coder/v2/testutil"
1921
)
@@ -388,6 +390,23 @@ const (
388390
func TestPushNotificationSubscription(t *testing.T) {
389391
t.Parallel()
390392

393+
t.Run("Disabled", func(t *testing.T) {
394+
t.Parallel()
395+
396+
client := coderdtest.New(t, &coderdtest.Options{
397+
PushNotifier: &push.NoopNotifier{
398+
Msg: assert.AnError.Error(),
399+
},
400+
})
401+
402+
ctx := testutil.Context(t, testutil.WaitShort)
403+
404+
owner := coderdtest.CreateFirstUser(t, client)
405+
memberClient, _ := coderdtest.CreateAnotherUser(t, client, owner.OrganizationID)
406+
err := memberClient.TestPushNotification(ctx)
407+
require.EqualError(t, err, assert.AnError.Error(), "test push notification should fail")
408+
})
409+
391410
t.Run("CRUD", func(t *testing.T) {
392411
t.Parallel()
393412

0 commit comments

Comments
 (0)