Repository navigation
test(mail): cover the date, base64, forward and batch helpers (#220) - #245
Merged
juancguerrerodev merged 4 commits intoDec 6, 2026
Merged
juancguerrerodev merged 4 commits into
juancguerrerodev merged 4 commits into
Conversation
10 of 16 tasks
Contributor
|
Ready to merge once the pull request template is filled in, including the "I read and ran everything" box (details on #234). 🦀 |
juancguerrerodev
force-pushed
the
test/mail-mime-helpers-220
branch
from
December 6, 2026 07:57
c121023 to
ffc5577
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #220
When Hermit sends, replies or forwards mail,
packages/mail/src/mime.tswrites the message andpackages/mail/src/http.tsruns the provider calls. A few small helpers there had no test that called them by name:mailDate,bytesToBase64,forwardTextandinBatches.What this PR does
packages/mail/test/mime-helpers.test.ts(Vitest, like the other files inpackages/mail/test). Tests only:mime.tsandhttp.tsare unchanged.buildMimeandencodeHeaderTextare left out, as they already have tests inwrite.test.ts.Tests
mailDate: a fixed instant gives the RFC 5322 date in UTC, and a single digit day, hour, minute and second show thezero padding.
bytesToBase64: inputs of 0, 1, 2 and 3 bytes give the right padding; withurl = truethe result has-and_instead of
+and/and no=; round trip withbase64ToBytesfrom../src/text.ts.forwardText: with a note, the note comes first and then a blank line; with a blank note there is no leading blankline; a
To:line appears only whentohas addresses; a line break insidefromorsubjectcannot start a newline.
inBatches: results keep the order of the input even when later tasks finish first; no more thanlimittasks runat once (counted in the task); an empty list gives an empty list without calling the task.
How to check
Keep in mind
example.comaddresses only.Pull request template
What and why
Closes #220.
Adds named tests for mailDate, bytesToBase64, forwardText and inBatches.
Vision fit
Principle 7, small, typed and tested: the send path's small helpers have tests of their own.
Non-negotiables
Checklist
acceptedproposal.pnpm check:privacy,pnpm typecheck,pnpm lint,pnpm testandnode scripts/guard/check.mjs --patterns scripts/guard/patterns.txt. Gate note: privacy and guard pass on this checkout today; the rest was run per package as listed under AI agents, not as one root gate on this Windows machine, where unrelated pre-existing failures appear in the site badges, the devices table and mobile source scans.packages/copy, in es-419 and en, with matching keys and placeholders, and no em or en dashes.Model path
packages/model,agent,skillsoreval, the prompt, the router, tool descriptions, normalizers, examples or the model file.Screenshots
New dependencies and network calls
None. No new dependency and no new network call.
AI agents
What was run: pnpm --filter @hermit/mail exec vitest run test/mime-helpers.test.ts (12/12); full @hermit/mail test at the time; typecheck; eslint.