Skip to content

Commit f5477fe

Browse files
committed
test: increase coverage to 100%
1 parent 88b16ec commit f5477fe

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

coverage/lcov.info

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ DA:58,2
1313
DA:59,2
1414
DA:60,1
1515
DA:62,1
16-
DA:68,0
17-
DA:73,0
16+
DA:68,2
17+
DA:73,2
1818
LF:16
19-
LH:14
19+
LH:16
2020
end_of_record

test/src/email_sendgrid_test.dart

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,25 @@ void main() {
8181
throwsA(isA<HttpException>()),
8282
);
8383
});
84+
85+
test('throws OperationFailedException on unexpected error', () async {
86+
// Arrange
87+
final exception = Exception('Unexpected error');
88+
when(
89+
() => mockHttpClient.post<void>(any(), data: any(named: 'data')),
90+
).thenThrow(exception);
91+
92+
// Act & Assert
93+
expect(
94+
() => emailClient.sendTransactionalEmail(
95+
senderEmail: senderEmail,
96+
recipientEmail: recipientEmail,
97+
templateId: templateId,
98+
templateData: templateData,
99+
),
100+
throwsA(isA<OperationFailedException>()),
101+
);
102+
});
84103
});
85104
});
86105
}

0 commit comments

Comments
 (0)