Skip to content

Commit c90ff21

Browse files
committed
sdkError
1 parent 341485f commit c90ff21

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

coderd/notifications_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package coderd_test
22

33
import (
4+
"net/http"
45
"testing"
56

67
"github.com/stretchr/testify/require"
@@ -31,7 +32,10 @@ func TestUpdateNotificationsSettings(t *testing.T) {
3132
err := anotherClient.PutNotificationsSettings(ctx, expected)
3233

3334
// then
34-
require.Error(t, err) // Insufficient permissions to update notifications settings.
35+
var sdkError *codersdk.Error
36+
require.Error(t, err)
37+
require.ErrorAsf(t, err, &sdkError, "error should be of type *codersdk.Error")
38+
require.Equal(t, http.StatusForbidden, sdkError.StatusCode())
3539
})
3640

3741
t.Run("Settings modified", func(t *testing.T) {

0 commit comments

Comments
 (0)