Skip to content

Commit 8696b70

Browse files
committed
given when then
1 parent 70e2d2c commit 8696b70

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

coderd/users_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ func TestNotifyCreatedUser(t *testing.T) {
605605
t.Run("OwnerNotified", func(t *testing.T) {
606606
t.Parallel()
607607

608+
// given
608609
notifyEnq := &testutil.FakeNotificationsEnqueuer{}
609610
adminClient := coderdtest.New(t, &coderdtest.Options{
610611
NotificationsEnqueuer: notifyEnq,
@@ -614,6 +615,7 @@ func TestNotifyCreatedUser(t *testing.T) {
614615
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
615616
defer cancel()
616617

618+
// when
617619
user, err := adminClient.CreateUser(ctx, codersdk.CreateUserRequest{
618620
OrganizationID: firstUser.OrganizationID,
619621
Email: "another@user.org",
@@ -622,6 +624,7 @@ func TestNotifyCreatedUser(t *testing.T) {
622624
})
623625
require.NoError(t, err)
624626

627+
// then
625628
require.Len(t, notifyEnq.Sent, 1)
626629
require.Equal(t, notifications.TemplateUserAccountCreated, notifyEnq.Sent[0].TemplateID)
627630
require.Equal(t, firstUser.UserID, notifyEnq.Sent[0].UserID)
@@ -632,6 +635,7 @@ func TestNotifyCreatedUser(t *testing.T) {
632635
t.Run("UserAdminNotified", func(t *testing.T) {
633636
t.Parallel()
634637

638+
// given
635639
notifyEnq := &testutil.FakeNotificationsEnqueuer{}
636640
adminClient := coderdtest.New(t, &coderdtest.Options{
637641
NotificationsEnqueuer: notifyEnq,
@@ -656,6 +660,7 @@ func TestNotifyCreatedUser(t *testing.T) {
656660
})
657661
require.NoError(t, err)
658662

663+
// when
659664
member, err := adminClient.CreateUser(ctx, codersdk.CreateUserRequest{
660665
OrganizationID: firstUser.OrganizationID,
661666
Email: "another@user.org",
@@ -664,6 +669,7 @@ func TestNotifyCreatedUser(t *testing.T) {
664669
})
665670
require.NoError(t, err)
666671

672+
// then
667673
require.Len(t, notifyEnq.Sent, 3)
668674

669675
// "User admin" account created, "owner" notified

0 commit comments

Comments
 (0)