Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3dd09d2

Browse files
committed
One more test
1 parent 68ae258 commit 3dd09d2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

coderd/notifications/manager_test.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,11 @@ func TestBuildPayload(t *testing.T) {
9898

9999
// GIVEN: a set of helpers to be injected into the templates
100100
const label = "Click here!"
101-
const url = "http://xyz.com/"
101+
const baseURL = "http://xyz.com"
102+
const url = baseURL + "/@bobby/my-workspace"
102103
helpers := map[string]any{
103104
"my_label": func() string { return label },
104-
"my_url": func() string { return url },
105+
"my_url": func() string { return baseURL },
105106
}
106107

107108
// GIVEN: an enqueue interceptor which returns mock metadata
@@ -112,7 +113,7 @@ func TestBuildPayload(t *testing.T) {
112113
actions := []types.TemplateAction{
113114
{
114115
Label: "{{ my_label }}",
115-
URL: "{{ my_url }}",
116+
URL: "{{ my_url }}/@{{.UserName}}/{{.Labels.name}}",
116117
},
117118
}
118119
out, err := json.Marshal(actions)
@@ -131,7 +132,9 @@ func TestBuildPayload(t *testing.T) {
131132
require.NoError(t, err)
132133

133134
// WHEN: a notification is enqueued
134-
_, err = enq.Enqueue(ctx, uuid.New(), notifications.TemplateWorkspaceDeleted, nil, "test")
135+
_, err = enq.Enqueue(ctx, uuid.New(), notifications.TemplateWorkspaceDeleted, map[string]string{
136+
"name": "my-workspace",
137+
}, "test")
135138
require.NoError(t, err)
136139

137140
// THEN: expect that a payload will be constructed and have the expected values

0 commit comments

Comments
 (0)