Skip to content

Commit 88b9796

Browse files
committed
Fix tests
Signed-off-by: Danny Kopping <danny@coder.com>
1 parent ece6fff commit 88b9796

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

cli/notifications_test.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ import (
1616
"github.com/coder/coder/v2/testutil"
1717
)
1818

19+
func createOpts(t *testing.T) *coderdtest.Options {
20+
t.Helper()
21+
22+
dt := coderdtest.DeploymentValues(t)
23+
dt.Experiments = []string{string(codersdk.ExperimentNotifications)}
24+
return &coderdtest.Options{
25+
DeploymentValues: dt,
26+
}
27+
}
28+
1929
func TestNotifications(t *testing.T) {
2030
t.Parallel()
2131

@@ -42,7 +52,7 @@ func TestNotifications(t *testing.T) {
4252
t.Parallel()
4353

4454
// given
45-
ownerClient, db := coderdtest.NewWithDatabase(t, nil)
55+
ownerClient, db := coderdtest.NewWithDatabase(t, createOpts(t))
4656
_ = coderdtest.CreateFirstUser(t, ownerClient)
4757

4858
// when

coderd/notifications/notifications_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,8 +799,9 @@ func TestCustomNotificationMethod(t *testing.T) {
799799
require.NoError(t, err)
800800
require.EventuallyWithT(t, func(ct *assert.CollectT) {
801801
msgs := mockSMTPSrv.MessagesAndPurge()
802-
assert.Len(ct, msgs, 1)
803-
assert.Contains(ct, msgs[0].MsgRequest(), fmt.Sprintf("Message-Id: %s", msgID))
802+
if assert.Len(ct, msgs, 1) {
803+
assert.Contains(ct, msgs[0].MsgRequest(), fmt.Sprintf("Message-Id: %s", msgID))
804+
}
804805
}, testutil.WaitLong, testutil.IntervalFast)
805806
}
806807

0 commit comments

Comments
 (0)