| 167 | } |
| 168 | |
| 169 | func TestEmailProvider_Invalid(t *testing.T) { |
| 170 | ctx := testlogging.Context(t) |
| 171 | |
| 172 | cases := []struct { |
| 173 | opt email.Options |
| 174 | wantError string |
| 175 | }{ |
| 176 | {opt: email.Options{}, wantError: "SMTP server must be provided"}, |
| 177 | {opt: email.Options{SMTPServer: "some.server.com"}, wantError: "From address must be provided"}, |
| 178 | {opt: email.Options{SMTPServer: "some.server.com", From: "some@example.com"}, wantError: "To address must be provided"}, |
| 179 | } |
| 180 | |
| 181 | for _, tc := range cases { |
| 182 | _, err := sender.GetSender(ctx, "my-profile", "email", &tc.opt) |
| 183 | require.ErrorContains(t, err, tc.wantError) |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | func TestMergeOptions(t *testing.T) { |
| 188 | var dst email.Options |