Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve tests for multipart messages #422

Merged
merged 10 commits into from
Jan 19, 2025

Conversation

wneessen
Copy link
Owner

@wneessen wneessen commented Jan 15, 2025

This PR adds more tests for the message processing that writes mails into memory and compares expected values.

This closes #420

This test ensures correct handling and formatting of multipart messages that include a plain text section and a file attachment. It validates headers, boundaries, and content structure to enforce expected message output.
Introduce `checkMessageContent` helper function to simplify and unify validation of message content in tests. This reduces redundancy and improves code readability by reusing a structured approach with the newly introduced `msgContentTest` type.
@wneessen wneessen linked an issue Jan 15, 2025 that may be closed by this pull request
Replaced FreeBSD 14.0 (EOL) with 14.2 in the GitHub Actions CI workflow. This ensures the tests run against the latest macOS version while maintaining backward compatibility.
Replaced manual response comparison logic with the `checkMessageContent` function for improved clarity and maintainability. This reduces redundancy and simplifies the test's structure while preserving its functionality.
This test verifies the creation and output of a message with both plain text and HTML alternatives, ensuring correct multipart/alternative formatting. It includes checks for headers, boundary markers, and content consistency.
This test validates the `WriteTo` method for a message containing plain text, HTML alternative, an attachment, and an embedded file. It ensures the correct structure and content of the multipart message, enhancing test coverage and reliability.
This test ensures correct handling of S/MIME signed messages containing plain text, HTML alternatives, embedded files, and attachments. It validates the message structure and content, covering scenarios with comprehensive MIME types and signing mechanisms.
Adjusted the formatting of a test case definition to enhance code readability. The change introduces a clearer structure by splitting a long line into a well-organized multi-line format. No functional logic was modified.
Introduced runtime-based file content type handling to account for differences in FreeBSD. This ensures tests correctly reflect platform-specific variations, switching from "text/plain" to "application/octet-stream" when necessary.
Refactored test cases to adjust `Content-Type` based on runtime OS. Removed redundant `charset=utf-8` where it was already covered by the file content type definition, ensuring consistency and correct MIME type handling across platforms.
@wneessen wneessen merged commit 7e0e484 into main Jan 19, 2025
29 checks passed
@wneessen wneessen deleted the chore/420_improve-tests-for-multipart-messages branch January 19, 2025 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve tests for multipart messages
1 participant