Skip to content

Commit 069cde4

Browse files
committed
test: add sender email to sendTransactionalEmail
- Added `senderEmail` parameter to `sendTransactionalEmail` function. - Updated tests to reflect the change. - Updated `from` email in test assertions.
1 parent 669a8cd commit 069cde4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/src/ht_email_sendgrid_test.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ignore_for_file: avoid_dynamic_calls
2+
13
import 'package:ht_email_sendgrid/ht_email_sendgrid.dart';
24
import 'package:ht_http_client/ht_http_client.dart';
35
import 'package:ht_shared/ht_shared.dart';
@@ -12,6 +14,7 @@ void main() {
1214
late HtHttpClient mockHttpClient;
1315
late HtEmailSendGrid emailClient;
1416

17+
const senderEmail = 'sender@example.com';
1518
const recipientEmail = 'test@example.com';
1619
const templateId = 'd-12345';
1720
const templateData = {'name': 'Test User'};
@@ -40,6 +43,7 @@ void main() {
4043

4144
// Act
4245
await emailClient.sendTransactionalEmail(
46+
senderEmail: senderEmail,
4347
recipientEmail: recipientEmail,
4448
templateId: templateId,
4549
templateData: templateData,
@@ -55,7 +59,7 @@ void main() {
5559

5660
final payload = captured.first as Map<String, dynamic>;
5761
expect(payload['template_id'], templateId);
58-
expect(payload['from']['email'], 'noreply@example.com');
62+
expect(payload['from']['email'], senderEmail);
5963
final personalizations =
6064
payload['personalizations'] as List<Map<String, dynamic>>;
6165
expect(personalizations.first['to'].first['email'], recipientEmail);
@@ -78,6 +82,7 @@ void main() {
7882
// Act & Assert
7983
expect(
8084
() => emailClient.sendTransactionalEmail(
85+
senderEmail: senderEmail,
8186
recipientEmail: recipientEmail,
8287
templateId: templateId,
8388
templateData: templateData,

0 commit comments

Comments
 (0)