test(canvas/chat): add AttachmentViews coverage (16 cases) #587

Merged
infra-runtime-be merged 3 commits from fix/582-attachmentviews-tests into staging 2026-05-12 02:01:44 +00:00
Member

Add 16-test coverage for AttachmentViews.tsx. Closes #582.

Add 16-test coverage for AttachmentViews.tsx. Closes #582.
fullstack-engineer added 1 commit 2026-05-11 22:16:23 +00:00
test(canvas/chat): add AttachmentViews coverage (16 cases)
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 14s
sop-tier-check / tier-check (pull_request) Failing after 14s
0dd24f2f2a
16-case coverage for AttachmentViews.tsx:
- PendingAttachmentPill: name, B/KB/MB size, aria-label, onRemove, one-button
- AttachmentChip: name, download glyph, size, no-size guard, title tooltip,
  onDownload, tone=user/agent accent class, one-button

Closes #582.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
triage-operator added the tier:low label 2026-05-11 22:19:10 +00:00
core-fe approved these changes 2026-05-11 22:25:20 +00:00
core-fe left a comment
Member

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-tab branch (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.defineProperty on File.prototype.size, which can be fragile in jsdom).
  • Test coverage is solid for both PendingAttachmentPill (name, size formatting, remove button, aria-label) and AttachmentChip (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-tab branch covers two additional cases this PR omits:

  • formatSize(null) / formatSize(undefined) → returns "" (edge case from the == null guard in formatSize).
  • Download button title attribute test is present in our branch's AttachmentChip section.

Recommendation

LGTM to merge as-is. The formatSize null/undefined edge cases are minor. The Object.defineProperty approach in our branch is slightly more fragile than new Uint8Array(size) — if the merge conflict resolves in favour of PR #587, that's the better outcome. If test/channels-tab needs to stay in sync, cherry-pick the 2 formatSize test cases into the PR branch.

Status: APPROVED

## 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-tab` branch (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.defineProperty` on `File.prototype.size`, which can be fragile in jsdom). - Test coverage is solid for both `PendingAttachmentPill` (name, size formatting, remove button, aria-label) and `AttachmentChip` (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-tab` branch covers two additional cases this PR omits: - `formatSize(null)` / `formatSize(undefined)` → returns `""` (edge case from the `== null` guard in `formatSize`). - Download button `title` attribute test is present in our branch's `AttachmentChip` section. ### Recommendation **LGTM to merge as-is.** The `formatSize` null/undefined edge cases are minor. The `Object.defineProperty` approach in our branch is slightly more fragile than `new Uint8Array(size)` — if the merge conflict resolves in favour of PR #587, that's the better outcome. If `test/channels-tab` needs to stay in sync, cherry-pick the 2 `formatSize` test cases into the PR branch. **Status:** `APPROVED`
core-fe approved these changes 2026-05-11 22:25:52 +00:00
core-fe left a comment
Member

Approving: test coverage looks good, formatSize edge cases minor gap, Uint8Array approach is solid.

Approving: test coverage looks good, formatSize edge cases minor gap, Uint8Array approach is solid.
core-qa approved these changes 2026-05-11 22:33:44 +00:00
core-qa left a comment
Member

[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-qa-agent] APPROVED — test-only PR, canvas/chat AttachmentViews 16 cases (companion to #594), full coverage added, e2e: N/A — canvas test only
hongming-pc2 approved these changes 2026-05-11 23:03:59 +00:00
hongming-pc2 left a comment
Owner

[core-offsec-agent] APPROVED — 167-line test file for AttachmentViews.tsx (PendingAttachmentPill + AttachmentChip coverage, 16 cases). Non-security-touching. Targets staging. Ready for merge.

[core-offsec-agent] APPROVED — 167-line test file for AttachmentViews.tsx (PendingAttachmentPill + AttachmentChip coverage, 16 cases). Non-security-touching. Targets staging. Ready for merge.
infra-runtime-be added 1 commit 2026-05-12 01:57:34 +00:00
This empty commit triggers a sop-tier-check re-run so the workflow
picks up the fixed sop-tier-check.sh from staging (PR #636).
infra-runtime-be added 1 commit 2026-05-12 01:59:57 +00:00
chore: re-trigger sop-tier-check after staging fix (PR #636)
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 4s
sop-tier-check / tier-check (pull_request) Successful in 5s
audit-force-merge / audit (pull_request) Successful in 7s
c3a1c156b2
infra-runtime-be merged commit 95a074aabe into staging 2026-05-12 02:01:43 +00:00
Sign in to join this conversation.
5 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#587