Repository navigation
Description
Task Summary
Four small frontend files are each a few untaken branches away from full coverage — 20 partial branches and 5 unhit lines between them. Codecov computes coverage = hits / lines and does not count a partially-covered line as a hit, so because these files are small the branches are worth a lot: roughly +15.6pp / +14.3pp / +12.0pp / +11.1pp respectively.
Goal: take the missing branch on each conditional so these files reach full coverage. All four already have a spec; extend it and re-run the coverage report to confirm the partials cleared. Vitest/jsdom; see frontend/TESTING.md. Each case below is a plain input variation — no timers, clock, or randomness involved.
Behavior to add
UserDatasetStagedObjectsListComponent (frontend/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/user-dataset-staged-objects-list/user-dataset-staged-objects-list.component.ts, 81.2%, 5 partials + 1 unhit)
if (event)— call the handler with and without an event.if (this.did)— render with a dataset id set and with it absent.if (!this.uploadTimeMap) return null— cover the no-map early return as well as the populated map.filePath.split("/").pop() || filePath— a path that yields an empty last segment (e.g. one ending in/), so the|| filePathfallback runs.this.uploadTimeMap.get(filename) || null— a filename that is not in the map.- The unhit
notificationService.error("Failed to delete the file")— make the delete service double reject and assert the notification.
SharedModel (frontend/src/app/workspace/service/workflow-graph/model/shared-model.ts, 78.6%, 4 partials + 2 unhit)
const suffix = wid ? \${wid}` : uuid()` — construct with a workflow id and without one (both arms).if (this.user)(two sites, incl.if (this.user) this.awareness.setLocalStateField(...)) — construct with a user and anonymously; with a user, the unhit lines that buildCoeditorStateand callawareness.setLocalState(userState)run.if (this.wsProvider.shouldConnect && this.wsProvider.wsconnected)— cover each half of the&&being false as well as both true (use a stubbed provider object; no real websocket).
UiUdfParametersComponent (frontend/src/app/workspace/component/ui-udf-parameters/ui-udf-parameters.component.ts, 84.0%, 6 partials + 2 unhit)
if (!(error instanceof UiUdfParametersEditError) && !(error instanceof UiUdfParameters…))— throw each of the two known error types and one unrelated error, so bothinstanceofchecks resolve each way.typeof field.fieldArray === "function" ? undefined : field.fieldArray— a field whosefieldArrayis a function and one where it is an object.if (!field) return(two sites) — call with an undefined field and with a real one.if (this.disabledStateConfigured.get(field) === disabled)— call twice with the same disabled value so the early-return arm runs, and once with a changed value so the unhitapplyDisabledState(field, disabled); return;lines run.
LandingPageComponent (frontend/src/app/hub/component/landing-page/landing-page.component.ts, 88.9%, 5 partials)
- The gap is the
|| []fallbacks when the hub returns nothing:workflowEntries["like"] || [],workflowEntries["clone"] || [],datasetEntries["like"] || [], andtopsMap[act] || []. Drive the component once with a populated hub response and once with a response missing those keys, asserting the lists end up empty rather than undefined.
Task Type
- Refactor / Cleanup
- DevOps / Deployment / CI
- Testing / QA
- Documentation
- Performance
- Other
Activity
test(frontend): cover the missing branches in SharedModel, staged obj…