Update client tests for message delivery indication

This commit adds checks in the testing functions to verify the successful implementation of message delivery status. A new attribute `isDelivered` is now being validated in our tests, reinforcing the message tracking system and enhancing the overall reliability of our application.
This commit is contained in:
Winni Neessen 2024-01-23 11:21:56 +01:00
parent 0b622368ba
commit 6746af4605
Signed by: wneessen
GPG key ID: 385AC9889632126E

View file

@ -763,6 +763,9 @@ func TestClient_DialSendClose(t *testing.T) {
if err := c.Close(); err != nil { if err := c.Close(); err != nil {
t.Errorf("Close() failed: %s", err) t.Errorf("Close() failed: %s", err)
} }
if !m.IsDelivered() {
t.Errorf("message should be delivered but is indicated no to")
}
} }
// TestClient_DialAndSendWithContext tests the DialAndSendWithContext() method of Client // TestClient_DialAndSendWithContext tests the DialAndSendWithContext() method of Client
@ -1134,7 +1137,9 @@ func TestClient_DialAndSendWithContext_withSendError(t *testing.T) {
} }
if se.IsTemp() { if se.IsTemp() {
t.Errorf("expected permanent error but IsTemp() returned true") t.Errorf("expected permanent error but IsTemp() returned true")
return }
if m.IsDelivered() {
t.Errorf("message is indicated to be delivered but shouldn't")
} }
} }