Repository navigation
Description
Task Summary
ListItemComponent renders every kind of dashboard entry — workflow, dataset, file — and dispatches on entry.type in half a dozen places, but the spec only ever feeds it one kind. The result is 26 uncovered lines and 23 half-taken branches at 71.83 %. Every one is an ordinary data-driven branch: give the component an entry of a different type, or one missing a field, and the arm runs.
Vitest/jsdom; see frontend/TESTING.md and frontend/AGENTS.md. Use the local coverage report to confirm each arm flipped — the lines below are where the report points today, not a fence.
Behavior to add
ListItemComponent (frontend/src/app/dashboard/component/user/list-item/list-item.component.ts, codecov 71.83 % — EXTEND list-item.component.spec.ts)
Parameterise the existing setup so a test can hand the component any entry type, then cover:
- The required-input guard (121–122) —
if (!this._entry) throw new Error("entry property must be provided."). Assert the throw when the component is created without anentry. - Icon dispatch (149–179) — the chain that picks
iconTypefromentry.type, including thedatasetbranch and its nestedtypeof this.entry.id === "number"check, thefilebranch that sets"folder-open", and the trailingthrow new Error("Unexpected type in DashboardEntry.")for a type the chain does not know. Cover each type and the unknown-type throw withexpect(() => …).toThrow(). renderMarkdownPreview(187–190) —const trimmed = (text ?? "").trim()then the early return that setsrenderedDescription = "". Cover an undefined description, a whitespace-only one, and a real one so both the??fallback and the empty-guard arms are taken.- Detail-modal creation (215–247) —
modalService.createis called with different configuration forworkflowand fordataset; thenif (modal)guards subscribing tomodal.componentInstance?.refresh, which re-emitsthis.refresh. Stub the modal service to return a handle with arefreshsubject, assert the right configuration per type, emit on the subject and assertrefreshfires. Also cover the case where the service returns nothing so theif (modal)false arm runs. - Download dispatch (253–261) — the
if (!this.entry.id) returnearly exit, thendownloadService.downloadWorkflowversusdownloadService.downloadDatasetper type. Stub the download service withof(...)and assert which method was called with which arguments. - Rename / description editing —
confirmUpdateCustomName(342),confirmUpdateCustomDescription(372) and theif (this.nameInput)focus path around 269. Cover both the present and absentnameInputview child. openDetailModal(398).
Determinism notes:
fixture.detectChanges()after each state change, andfixture.destroy()inafterEachso theuntilDestroyedsubscriptions on the modal-refresh and download streams do not outlive their test.- Clone the entry fixture per test — several of these handlers mutate the entry in place (a rename leaks into a later "unchanged" assertion if a single shared object is reused).
- Stub
modalServiceanddownloadService; never open a real modal or hit a backend. Useof(...)so streams emit synchronously. - No layout or geometry assertions —
nativeElement.focus()may be spied on, butgetBoundingClientRectand friends return zeros under jsdom. vi.restoreAllMocks()inafterEach.
Note #7463 is open and removes the deprecated project feature, which touches this component — rebase before finishing and do not build assertions around project-type entries.
Task Type
- Refactor / Cleanup
- DevOps / Deployment / CI
- Testing / QA
- Documentation
- Performance
- Other
Activity
test(frontend): cover the dashboard list item's per-entry-type dispat…