Skip to content

Commit 75ec8db

Browse files
committed
Add tests
1 parent f561668 commit 75ec8db

File tree

1 file changed

+38
-5
lines changed

1 file changed

+38
-5
lines changed

tests/Unit/FileMessageTest.php

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@
144144
expect($message->attachments())->toBe([]);
145145
});
146146

147-
test('it can parse other header fields like IN-REPLY-TO', function () {
147+
test('it can parse In-Reply-To header', function () {
148148
$contents = <<<'EOT'
149149
From: "John Doe" <[email protected]>
150-
150+
In-Reply-To: <[email protected]>
151151
Subject: In-Reply-To Check
152152
Date: Wed, 19 Feb 2025 12:34:56 -0500
153153
Content-Type: text/plain; charset="UTF-8"
@@ -157,9 +157,42 @@
157157

158158
$message = new FileMessage($contents);
159159

160-
$address = $message->inReplyTo();
161-
expect($address)->not->toBeNull();
162-
expect($address->email())->toBe('[email protected]');
160+
expect($message->inReplyTo())->toBe(['[email protected]']);
161+
});
162+
163+
test('it can parse In-Reply-To header with multiple values', function () {
164+
$contents = <<<'EOT'
165+
From: "John Doe" <[email protected]>
166+
167+
Subject: In-Reply-To Check
168+
Date: Wed, 19 Feb 2025 12:34:56 -0500
169+
Content-Type: text/plain; charset="UTF-8"
170+
171+
Check the in-reply-to header
172+
EOT;
173+
174+
$message = new FileMessage($contents);
175+
176+
expect($message->inReplyTo())->toBe([
177+
178+
179+
180+
]);
181+
});
182+
183+
test('it returns empty array when In-Reply-To header is missing', function () {
184+
$contents = <<<'EOT'
185+
From: "John Doe" <[email protected]>
186+
Subject: No In-Reply-To
187+
Date: Wed, 19 Feb 2025 12:34:56 -0500
188+
Content-Type: text/plain; charset="UTF-8"
189+
190+
No in-reply-to header
191+
EOT;
192+
193+
$message = new FileMessage($contents);
194+
195+
expect($message->inReplyTo())->toBe([]);
163196
});
164197

165198
test('it can be cast to a string via __toString()', function () {

0 commit comments

Comments
 (0)