Add unit tests for the mail text helpers
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 88/100
- Issue 类型
- 文档
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- testing
调研方向
阅读packages/mail/src/text.ts和packages/mail/test中的一个相邻测试,以遵循Vitest的惯例。添加packages/mail/test/text.test.ts,包含issue中列出的七组案例,保持text.ts不变,并且只使用虚构地址。运行pnpm --filter @hermit/mail test和pnpm --filter @hermit/mail test test/text.test.ts;完成标准是新测试通过,并且在故意破坏某个预期时失败。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- TypeScript
- 星标
- 11
- 派生
- 0
- 平均合并
- 10 分钟
- 30 天内合并 PR
- 6
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
DojoCodingLabs/hermit 的其他 Issue
-
docs good first issue
难度 2/5 1-3 小时 新手友好度 87/100
DojoCodingLabs/hermit#73 ·
维护者通常 1 天内回复
-
device-lab
难度 2/5 1-3 小时 新手友好度 70/100
DojoCodingLabs/hermit#45 ·
维护者通常 1 天内回复
-
device-lab
难度 2/5 1-3 小时 新手友好度 62/100
DojoCodingLabs/hermit#44 ·
维护者通常 1 天内回复
-
device-lab
难度 2/5 1-3 小时 新手友好度 72/100
DojoCodingLabs/hermit#43 ·
维护者通常 1 天内回复
-
agent-friendly docs good first issue
难度 2/5 1-3 小时 新手友好度 88/100
DojoCodingLabs/hermit#39 ·
维护者通常 1 天内回复
查看 DojoCodingLabs/hermit 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 86/100
superlinked/sie#1033 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
remix-run/react-router#15838 ·
维护者通常 1 天内回复
-
area/ci bug
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
melgarafael/DeskcommCRM#5290 ·
维护者通常 1 天内回复