6
6
"slices"
7
7
"testing"
8
8
9
+ "github.com/stretchr/testify/assert"
9
10
"github.com/stretchr/testify/require"
10
11
11
12
"github.com/coder/serpent"
@@ -14,6 +15,7 @@ import (
14
15
"github.com/coder/coder/v2/coderd/database"
15
16
"github.com/coder/coder/v2/coderd/notifications"
16
17
"github.com/coder/coder/v2/coderd/notifications/notificationstest"
18
+ "github.com/coder/coder/v2/coderd/notifications/push"
17
19
"github.com/coder/coder/v2/codersdk"
18
20
"github.com/coder/coder/v2/testutil"
19
21
)
@@ -388,6 +390,23 @@ const (
388
390
func TestPushNotificationSubscription (t * testing.T ) {
389
391
t .Parallel ()
390
392
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
+
391
410
t .Run ("CRUD" , func (t * testing.T ) {
392
411
t .Parallel ()
393
412
0 commit comments