Companion: add a functional test for the Mermaid render DOM mutations
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 42/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, typescript
- Domain
- testing-qa
Research direction
Start with the render functions in apps/api/src/companion/v1.js (lines 137-200), then the mirror tests in apps/api/src/companion/mermaidScanner.test.ts to see how existing tests mirror the browser code. Add a jsdom-based test that stubs mermaid.render and asserts the primer-mermaid wrapper, data-mermaid-source attribute, and primer-mermaid-error note. Done when the test passes and covers the theme re-render round-trip.
Written by the indexing model from the issue text.
Description
Surfaced by: code review on #15 (Mermaid auto-rendering).
The Task 3 wiring added renderAllMermaidBlocks, renderOneMermaidBlock, loadMermaidOnce, and reRenderMermaidForTheme to apps/api/src/companion/v1.js. Coverage today:
apps/api/src/companion/mermaidScanner.test.ts— mirror tests forfindMermaidBlocks+documentHasMermaidBootstrap. Strong.apps/api/src/routes/companion.test.ts— smoke assertion that the new function names appear in the served body. Catches the "new code shipped" case but not behavior.
Missing: a jsdom-driven mirror that exercises the render-DOM-mutation logic — wrapper shape (<div class=\"primer-mermaid\" data-mermaid-source>), error-path inline note (<div class=\"primer-mermaid-error\">), data-mermaid-source round-trip on theme re-render. We can stub out mermaid.render to return a known string and assert the resulting DOM shape.
Worth doing the next time anyone touches the render pipeline.
apps/api/src/companion/v1.js:137-200
- Dominant language
- TypeScript
- Stars
- 2
- Forks
- 1
- Avg merge
- 13h 38m
- Merged PRs (30d)
- 24
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No 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 0xPolygon/primer
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Feature: @-mention people and agents in documents and comments; a mention notifies and subscribesOpen
Difficulty 5/5 Over a week Newbie friendliness 18/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 Half a day Newbie friendliness 45/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
0xPolygon/primer#185 · 1 comment ·
Maintainers usually reply within 1 day
All issues in 0xPolygon/primer
Similar issues
-
P3
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
bug L3 level 1 needs-review wocs
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
SatyamPandey-07/WorkSphere#10739 · 1 comment ·
Maintainers usually reply within 1 day
-
maintenance
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
assistant-ui/assistant-ui#10946 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:auth-provider issue-rating: 🦞 diamond lobster no-stale P2
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
openclaw/openclaw#206303 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day