Repository navigation
Tests for attachments, clean-up actions, rules and middleware - #3
Open
ravimehra9911 wants to merge 1 commit into
Open
ravimehra9911 wants to merge 1 commit into
ravimehra9911 wants to merge 1 commit into
Conversation
Adds 63 Vitest tests for the code that moves mail, unsubscribes, runs rules and saves attachments. No mailbox is contacted: the IMAP functions and moveMessages are mocked, each file uses a temp DATA_DIR, and the attachment tests point os.homedir() at a temp folder so Downloads/MailClean is never real. - attachments: format grouping, skipping saved parts, adopting a legacy file only when unclaimed, "name (2).pdf", .part cleanup on stream errors, cancel finishing the current file, status leaving "running" when getAccount throws, openFolder rejecting files, outside paths, MailCleanEvil and "..". - actions: keep starred/important, keep newest N (within the scope), archive only inbox mail, ids passed per account, one-click SSRF guard, bulk plan. - rules: sender / Gmail tab / older-than matching, flagged mail always kept. - stats: scopeSql, "Mostly unread" and newsletter filters. - middleware: token, DNS-rebinding host check, 423 lock except /api/lock, old Vercel host redirect. No app code changed.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Adds 63 Vitest tests (100 in total) for MailClean's highest-risk code, which had none: deleting and archiving mail, unsubscribing, rules, attachment downloads and the request middleware. No app code changed.
No real mailbox or Downloads folder is touched. The IMAP functions and
moveMessagesare mocked, each test file uses its own tempDATA_DIR, and the attachment tests pointos.homedir()at a temp folder.Covered
name (2).pdf;.partremoved when the stream fails; cancel finishing the current file, then statuscancelled; status leavingrunningwhengetAccountthrows;openFolderrejecting files, outside paths,MailCleanEviland...scopeSql; the "Mostly unread" and newsletter filters, which agree with the Overview count.MAILCLEAN_TOKENis set; DNS-rebinding host check; 423 while locked except/api/lock; old Vercel address redirected.Checks
npm run typecheck,npm run lintandnpm testpass locally.+ path.sepfrom theopenFoldercheck, the old "Mostly unread" HAVING clause, dropping the.partcleanup, and always setting status todone.