mengw15 opened a new issue, #7683:
URL: https://github.com/apache/texera/issues/7683
### Task Summary
Three workspace services are missing **branch** coverage rather than line
coverage: their lines all execute, but one side of a conditional never does.
Codecov computes `coverage = hits / lines` and a partially-covered line is
**not** counted as a hit, so these cost real percentage points — 30 partial
branches and 8 unhit lines across the three, worth roughly **+9.8pp / +6.0pp /
+4.1pp** on the respective files.
**Goal: cover the missing branch cases so each file reaches full coverage.**
All three already have a spec; extend it and re-run the coverage report to
confirm the partials cleared. Vitest/jsdom; see `frontend/TESTING.md`. None of
these has a timer, clock, or randomness hazard.
### Behavior to add
**UiUdfParametersParserService**
(`frontend/src/app/workspace/service/code-editor/ui-udf-parameters-parser.service.ts`,
~89%, 14 partials + 2 unhit) — pure parsing, no dependencies
- `if (!code) return []` — parse an empty / undefined source.
- `body ? getChildren(body) : []` (two sites) — a function whose body is
absent.
- The trailing-separator ternary `lines.length > 1 && statements.length > 1
? "\n" : …` — cover single-line and single-statement inputs so both arms run.
- The identifier fallback `name.replace(/\W/g,"_").replace(/^(?=\d)/,"_") ||
"para…"` — a name that sanitizes to an empty string.
- `newline === -1 ? code.length : newline` — a position with no following
newline.
- `code.slice(...).match(/^[ \t]*/)?.[0]` — the branch where the match
returns undefined.
- The unhit `else return undefined` and `return []` arms.
**ValidationWorkflowService**
(`frontend/src/app/workspace/service/validation/validation-workflow.service.ts`,
~90%, 8 partials + 5 unhit)
- `if (operator === undefined)` (two sites) — assert it throws ``operator
with ID ${operatorID} doesn't exist``.
- `if (operatorSchema === undefined)` (two sites) — assert it throws
`"operatorSchema doesn't exist"`.
- `if (errors)` and the per-error ternary `error.message ? … : …` — feed a
validation result with errors that do and do not carry a message.
- `if (!satisfyInput)` — an operator whose required input ports are
unsatisfied.
- `getWorkflowValidationErrorStream` — subscribe so the observable accessor
line runs.
**SharedModelChangeHandler**
(`frontend/src/app/workspace/service/workflow-graph/model/shared-model-change-handler.ts`,
~95%, 8 partials + 1 unhit)
- `if (event.transaction.local)` and `if (isLocal)` — drive one change
originating locally and one applied as a remote update, so both arms run.
- `if (newPosition)` — a move event with and without a position.
- `isDefined(event.delta[0]?.delete) || isDefined(event.delta[1]?.delete)` —
a delta whose delete sits at index 0, and one at index 1.
- The `isInput ? … : …` ternaries (two sites) — an input-port change and an
output-port change.
- `else if (event.path.length >= 3)` — a nested path event.
- The unhit `throw new Error(\`undefined port operation on shared type:
.${event}\`)` — an event that matches no known port operation.
- Follow the approach already used by this file's spec (PR #6772): a
headless `joint.dia.Graph` plus a real `Y.Doc`; no Paper and no websocket
provider are needed.
### Task Type
- [ ] Refactor / Cleanup
- [ ] DevOps / Deployment / CI
- [x] Testing / QA
- [ ] Documentation
- [ ] Performance
- [ ] Other
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]