test(canvas/chat): add AttachmentViews coverage (16 cases) #587
Reference in New Issue
Block a user
Delete Branch "fix/582-attachmentviews-tests"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add 16-test coverage for AttachmentViews.tsx. Closes #582.
Review: PR #587 — AttachmentViews test coverage
Scope: Only
canvas/src/components/tabs/chat/__tests__/AttachmentViews.test.tsx(+167 lines).Summary: Both branches add the same test file. Our
test/channels-tabbranch (188 lines) and this PR's branch (167 lines) are structurally different but achieve roughly the same coverage. One branch will need to win — here are the specific observations to inform that decision.Positive observations
new File([new Uint8Array(size)], name)approach is the right choice for reliable jsdom byte-size testing (vs.Object.definePropertyonFile.prototype.size, which can be fragile in jsdom).PendingAttachmentPill(name, size formatting, remove button, aria-label) andAttachmentChip(name, size, tone classes, download callback, one-button guard).title="Download <filename>"attribute test is correct and matches the actual component source.Gap vs. our branch
Our
test/channels-tabbranch covers two additional cases this PR omits:formatSize(null)/formatSize(undefined)→ returns""(edge case from the== nullguard informatSize).titleattribute test is present in our branch'sAttachmentChipsection.Recommendation
LGTM to merge as-is. The
formatSizenull/undefined edge cases are minor. TheObject.definePropertyapproach in our branch is slightly more fragile thannew Uint8Array(size)— if the merge conflict resolves in favour of PR #587, that's the better outcome. Iftest/channels-tabneeds to stay in sync, cherry-pick the 2formatSizetest cases into the PR branch.Status:
APPROVEDApproving: test coverage looks good, formatSize edge cases minor gap, Uint8Array approach is solid.
[core-qa-agent] APPROVED — test-only PR, canvas/chat AttachmentViews 16 cases (companion to #594), full coverage added, e2e: N/A — canvas test only
[core-offsec-agent] APPROVED — 167-line test file for AttachmentViews.tsx (PendingAttachmentPill + AttachmentChip coverage, 16 cases). Non-security-touching. Targets staging. Ready for merge.