This repository was archived by the owner on Jul 30, 2026. It is now read-only.
tests: extract buildRecipients + partial implementation of crypto-popup.test.ts - #115
Merged
Conversation
…ests
Pulls the SerializedRecipient -> Recipient[] mapping out of
yivi-popup.ts into src/pages/yivi-popup/recipients.ts. The popup now
calls buildRecipients(pg.recipient, data.recipients); production
behavior is unchanged.
Implements 5 of 23 it.todo placeholders in crypto-popup.test.ts (the
recipient-rebuild subset). The remaining placeholders need the popup
loaded under jsdom or its handle{Encrypt,Decrypt} closures extracted
behind injected pg/runtime deps — left as todos rather than written
as shape-check noise. (Refactoring those closures is a much larger
change than this test PR should carry.)
Test report: 59 -> 64 passing (+5), 82 -> 78 todo.
Refs #105.
Contributor
Author
There was a problem hiding this comment.
Self-review (the bot opened this PR, so GH blocks --approve). Posting findings here for the human reviewer:
buildRecipientsis a clean, behaviour-preserving extraction fromyivi-popup.ts: same branch onr.type, samepolicyiteration, sameEMAIL_ATTRIBUTE_TYPEskip.RecipientFactory = Pick<PostGuard["recipient"], "email" | "emailDomain">keeps the production call site type-safe while letting tests inject a fake.- Tests cover the meaningful invariants: typed-vs-domain dispatch, no double-counting the email attribute, no
extraAttributewhen policy is absent, andextraAttributecalls for non-email policy entries. npm testlocally: 64 passed / 78 todo, matching the PR description. CI build is green.
The remaining 18 todos for handleEncrypt / handleDecrypt / DOM init are out of scope here and clearly documented as needing a deeper refactor.
No blockers from this agent's side — ready for human approval and merge.
rubenhensen
approved these changes
May 16, 2026
This was referenced May 16, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Follow-up to #110 (PR 5 of 5 per the plan on #105).
Summary
Pulls the `SerializedRecipient[] -> Recipient[]` mapping out of `yivi-popup.ts` into a new `src/pages/yivi-popup/recipients.ts`. The popup now calls `buildRecipients(pg.recipient, data.recipients)`. Production behavior is unchanged.
Implements 5 of 23 `it.todo` placeholders in `tests/crypto-popup.test.ts` (the recipient-rebuild subset: typed-vs-domain, custom policy mapping, no double-counting the email attribute, no `extraAttribute` when policy is absent).
The remaining 18 placeholders are scoped to the popup's `handleEncrypt` / `handleDecrypt` closures and the popup's DOM init. Reaching them needs either:
Both are substantial refactors and out of scope for this batch of test PRs. Tracking the remaining surface here so it isn't forgotten — the test count goes back up once that refactor lands.
Test report
Before: 59 passing, 82 todo.
After: 64 passing, 78 todo. (+5 tests; -4 todos)
Combined progress across the 5 follow-up PRs (#111–#115)
Once all five land the suite moves from 21→87 passing and 108→48 todo — the remaining todos are the closures that need the larger refactor noted above.
Reviewer quickstart
```
git fetch origin && git checkout tests/crypto-popup && npm install && npm test
```
Refs #105.