Add unit tests for the mail text helpers
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- testing
Research direction
Read packages/mail/src/text.ts and a neighboring test in packages/mail/test to follow the Vitest conventions. Add packages/mail/test/text.test.ts with the seven groups of cases listed in the issue, keeping text.ts unchanged and using only fictional addresses. Run pnpm --filter @hermit/mail test and pnpm --filter @hermit/mail test test/text.test.ts; done means the new tests pass and fail when an expectation is deliberately broken.
Written by the indexing model from the issue text.
Description
Why
packages/mail/src/text.ts turns Gmail, Outlook and IMAP message bodies into plain text, and none of its helpers has a test file of its own. ROADMAP.md, Now: mail is part of the everyday loop.
What to do
Create packages/mail/test/text.test.ts (Vitest, like the other files in packages/mail/test) and import from ../src/text.ts. Cover:
base64ToBytes: plain base64, base64url (-and_), and text with padding and line breaks.utf8DecodeanddecodeBase64Text: Spanish accents and ñ, a four-byte character, and a broken sequence that becomes U+FFFD.decodeEntities: named (á,ñ,&), decimal and hex references, and an unknown name left as it is.htmlToText:script,style,headandtitledropped with their contents, comments dropped, a line break atbr,p,div,liand headings, and no blank lines left.plainText: CRLF becomes LF, runs of spaces collapse, and at most one blank line remains in a row.clip: text at or under the limit unchanged; longer text cut, with "..." and no space before it.splitAddresses: commas inside quotes and inside angle brackets don't split; an empty or missing header gives an empty list.
Check that each test can fail: break one expectation on purpose, see it fail, put it back.
Done when
pnpm --filter @hermit/mail testruns the new file and it passes.packages/mail/src/text.tsis unchanged.
How to check
pnpm --filter @hermit/mail test
pnpm --filter @hermit/mail test test/text.test.ts
Keep in mind
- Tests only. If a test shows a real bug (for example,
clip("hello", 2)returns more than two characters), open a bug report and leavetext.tsalone here. - Leave
oneLine()out. It flattens fields other people control before the model reads them, so its tests get their own issue. - Made-up people and
example.comaddresses only. Never paste a real message.
- Dominant language
- TypeScript
- Stars
- 11
- Forks
- 0
- Avg merge
- 10m
- Merged PRs (30d)
- 6
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DojoCodingLabs/hermit
-
docs good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 87/100
DojoCodingLabs/hermit#73 ·
Maintainers usually reply within 1 day
-
device-lab
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
DojoCodingLabs/hermit#45 ·
Maintainers usually reply within 1 day
-
device-lab
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
DojoCodingLabs/hermit#44 ·
Maintainers usually reply within 1 day
-
device-lab
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
DojoCodingLabs/hermit#43 ·
Maintainers usually reply within 1 day
-
agent-friendly docs good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
DojoCodingLabs/hermit#39 ·
Maintainers usually reply within 1 day
All issues in DojoCodingLabs/hermit
Similar issues
-
bug zoo
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
software-mansion/runntime#151 ·
Maintainers usually reply within 4 days
-
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
sidebandstudio/clawtrate#728 ·
Maintainers usually reply within 1 day
-
enhancement github_actions help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
tranquilo-art/tranquilo-app#254 ·
Maintainers usually reply within 1 day
-
documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Tfoucher5/fuzzy-toolkit#44 ·
Maintainers usually reply within 1 day
-
bug tooling
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
endora-commerce/endora-commerce#1978 ·
Maintainers usually reply within 1 day