mengw15 opened a new pull request, #6831:
URL: https://github.com/apache/texera/pull/6831

   ### What changes were proposed in this PR?
   
   Extends the `HuggingFaceComponent` spec to close the coverage gaps that 
remain
   after #6773.
   
   **Note on the issue's premise:** #6828 cites ~80% / 57 uncovered lines, but 
that
   is pre-#6773 codecov data — the component's **statement/line coverage is 
already
   100%**. Measuring locally (`ng test --include <spec> --coverage`) showed the 
real
   remaining gaps are the **template's event bindings** (the existing spec never
   rendered/clicked anything) and a handful of **fallback branches**. This PR
   targets exactly those:
   
   | | before | after |
   |---|---|---|
   | `hugging-face.component.html` statements | 84.67% | **97.58%** |
   | `hugging-face.component.html` branches | 77.77% | **94.44%** |
   | `hugging-face.component.ts` branches | 91.04% | **94.78%** |
   
   14 added tests:
   
   - **Rendered-template interactions** (new `By.css` + `triggerEventHandler` 
block — the existing spec called methods directly, so none of the template's 
`(click)`/`(ngModelChange)` bindings were exercised): selecting a model item, 
clearing the selected model, the Prev/Next pagination buttons, both Retry 
buttons (models-load and tasks-load failures), the search input, the search 
clear icon, the task dropdown, and the search-specific empty-state message.
   - **Fallback branches**: the empty-tag `|| "text-generation"` fallback in 
`loadAllModels` / `retryLoad` / the server-side search, and persisting a task 
when the field has no `parent` and the form has no `task` control.
   
   **Determinism:** the added tests reuse the spec's existing hygiene
   (`invalidateHuggingFaceModelCache()` per test, `fixture.destroy()` +
   `http.verify()` in `afterEach`, `fakeAsync`/`tick` for the 300 ms debounce). 
I
   deliberately left three candidate branches uncovered rather than ship a 
fragile
   test: the two "in-flight fetch canceled" poll branches (couldn't be driven
   deterministically) and the formly validation-message block (needs extra 
formly
   config). Two others (`snapshot` hasOwnProperty, `defaults[key] ?? ""`) are
   unreachable — every key is always populated.
   
   No production code was changed.
   
   ### Any related issues, documentation, discussions?
   
   Closes #6828
   
   ### How was this PR tested?
   
   Extended unit tests, run locally in `frontend/`:
   
   ```
   ng test --watch=false --include 
src/app/workspace/component/hugging-face/hugging-face.component.spec.ts
   # Test Files 1 passed (1) | Tests 85 passed (85)   — 3 consecutive runs, 0 
flakes
   prettier --write <spec>   # unchanged
   eslint  <spec>            # clean
   ```
   
   The failure path was verified by deliberately breaking a new assertion and
   confirming the suite exits non-zero.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 4.8 [1M context])
   


-- 
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]

Reply via email to