Add unit tests for the mail text helpers
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 88/100
- Tipo de issue
- Documentação
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- typescript
- Domínio
- testing
Direção de pesquisa
Leia packages/mail/src/text.ts e um teste próximo em packages/mail/test para seguir as convenções do Vitest. Adicione packages/mail/test/text.test.ts com os sete grupos de casos listados na issue, mantenha text.ts inalterado e use apenas endereços fictícios. Execute pnpm --filter @hermit/mail test e pnpm --filter @hermit/mail test test/text.test.ts; o trabalho estará concluído quando os novos testes passarem e falharem se uma expectativa for deliberadamente quebrada.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- TypeScript
- Estrelas
- 11
- Forks
- 0
- Merge médio
- 10min
- PRs com merge (30d)
- 6
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de DojoCodingLabs/hermit
-
docs good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 87/100
DojoCodingLabs/hermit#73 ·
Mantenedores costumam responder em até 1 dia
-
device-lab
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
DojoCodingLabs/hermit#45 ·
Mantenedores costumam responder em até 1 dia
-
device-lab
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
DojoCodingLabs/hermit#44 ·
Mantenedores costumam responder em até 1 dia
-
device-lab
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
DojoCodingLabs/hermit#43 ·
Mantenedores costumam responder em até 1 dia
-
agent-friendly docs good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
DojoCodingLabs/hermit#39 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de DojoCodingLabs/hermit
Issues semelhantes
-
bug zoo
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
software-mansion/runntime#151 ·
Mantenedores costumam responder em até 4 dias
-
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 86/100
sidebandstudio/clawtrate#728 ·
Mantenedores costumam responder em até 1 dia
-
enhancement github_actions help wanted
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
tranquilo-art/tranquilo-app#254 ·
Mantenedores costumam responder em até 1 dia
-
documentation good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
Tfoucher5/fuzzy-toolkit#44 ·
Mantenedores costumam responder em até 1 dia
-
bug tooling
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 73/100
endora-commerce/endora-commerce#1978 ·
Mantenedores costumam responder em até 1 dia