mengw15 opened a new issue, #7679:
URL: https://github.com/apache/texera/issues/7679
### Task Summary
`DatasetDetailComponent` is the largest remaining coverage gap in the
frontend: **28 uncovered lines in its template**
(`dataset-detail.component.html`, ~89%) and **18 in its class**
(`dataset-detail.component.ts`, ~90%). #7435 covered the toolbar and upload
panel; what is left is the contributor-management markup, a few view controls,
and the upload **failure** paths.
**Goal: bring both files to full coverage** — render the remaining markup,
drive it through the DOM, and cover the error branches; then use the local
coverage report to catch anything left. Vitest/jsdom; see
`frontend/TESTING.md`. The spec does not use `TestBed.overrideComponent`, so
template coverage is attributed normally.
### Behavior to add — template (`dataset-detail.component.html`, 28 lines)
Render each block and fire its binding via
`fixture.debugElement.query(By.css("..."))` + `.triggerEventHandler(...)`,
calling `fixture.detectChanges()` after every state change:
- **Contributor management** — `(click)="onEditContributor(contributor)"`,
the delete confirm `(nzOnConfirm)="onDeleteContributor(contributor)"`, and the
add-contributor input's `(keydown.enter)="onAddContributor()"` plus
`(keydown.space)="$event.preventDefault(); onAddContributor()"` (for the space
handler, pass an event whose `preventDefault` is a spy and assert it fired).
Seed a dataset with a couple of contributors so the list renders.
- **View controls** — `(click)="onClickDownloadCurrentFile()"` and both
`(click)="onClickScaleTheView()"` triggers; assert the delegated service call /
the scaled state.
- **Sider resize** — `(nzResize)="onSideResize($event)"`: fire the handler
with a `NzResizeEvent` and assert `siderWidth` updates. Note `onSideResize`
uses `requestAnimationFrame`; assert the state the callback sets after flushing
the frame (or assert `cancelAnimationFrame` was called for the previous id via
a spy) — **do not** assert any rendered pixel width, which is zero under jsdom.
### Behavior to add — class (`dataset-detail.component.ts`, 18 lines)
The gap is the **upload failure handling**:
- A `409 Conflict` from the upload → the specific conflict notification is
shown; any other error → the generic `"Upload failed. Please retry."`
notification. Drive both by making the upload service double reject with each
status and assert on the `NotificationService` spy.
- After a failure, the matching entry in `uploadTasks` is rewritten (its
percentage restored rather than left at 100) and `scheduleHide(taskIndex)` is
called; assert the task list state. Cover the "task not found" arm (`taskIndex
=== -1`) too.
- `onUploadComplete()` runs on both the success and failure paths.
### Determinism
The component uses `new Date` and a `setTimeout`. **Do not assert any
rendered date/time string** — a fixed epoch renders differently under a UTC CI
runner; assert element presence or a timezone-stable substring. **Do not add
`vi.useFakeTimers()` merely to suppress the timeout** — a synchronous test body
never runs the callback, and layering fake timers over zone.js's patched timers
is Node-version dependent and has caused CI-only failures. Reject the mocked
upload with `Promise.reject(...)` / `throwError(...)` and `await` it rather
than waiting on real time.
### 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]