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

Skip to content

Commit adffe60

Browse files
committed
chore(coderd/notifications): improve failed test feedback
1 parent e741c43 commit adffe60

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

coderd/notifications/notifications_test.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -960,13 +960,15 @@ func TestNotificationTemplates_Golden(t *testing.T) {
960960
return
961961
}
962962

963+
hint := "run \"DB=ci make update-golden-files\" and commit the changes"
964+
963965
wantBody, err := os.ReadFile(bodyGoldenFile)
964-
require.NoError(t, err, "open golden file, run \"DB=ci make update-golden-files\" and commit the changes")
966+
require.NoError(t, err, fmt.Sprintf("missing golden notification body file. %s", hint))
965967
wantTitle, err := os.ReadFile(titleGoldenFile)
966-
require.NoError(t, err, "open golden file, run \"DB=ci make update-golden-files\" and commit the changes")
968+
require.NoError(t, err, fmt.Sprintf("missing golden notification title file. %s", hint))
967969

968-
require.Equal(t, string(wantBody), body, "body should be equal")
969-
require.Equal(t, string(wantTitle), title, "title should be equal")
970+
require.Equal(t, string(wantBody), body, "rendered template body does not match golden file. If this is expected, %s", hint)
971+
require.Equal(t, string(wantTitle), title, "rendered template title does not match golden file. If this is expected, %s", hint)
970972
})
971973
}
972974
}

0 commit comments

Comments
 (0)