mengw15 opened a new issue, #7497:
URL: https://github.com/apache/texera/issues/7497

   ### Task Summary
   
   Three dashboard/workspace components have small but real gaps in their 
**class files** (~29 uncovered lines total) — mostly error/branch paths that 
the existing specs never reach. **Goal: bring each file to full coverage** — 
cover the listed branches and use the local coverage report to catch anything 
remaining. Vitest/jsdom; see `frontend/TESTING.md`. No infra: mock the injected 
services with `vi.fn()` or existing `Stub…Service` doubles.
   
   ### Behavior to add
   
   **UserDatasetFileRendererComponent** 
(`frontend/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/user-dataset-file-renderer/user-dataset-file-renderer.component.ts`,
 ~88%, 11 lines)
   - `readXlsxFile` — the spreadsheet path is entirely unhit: feed a small 
workbook blob and assert the parsed rows land in the component's table state; 
also cover the parse-failure arm.
   - The remaining uncovered `if` arms around it — the mime-type `switch` 
fallthrough and the size/type guards that decide which renderer is used. Drive 
each by supplying a file of the matching type.
   - **Stub `FileReader` deterministically** (a fake whose 
`readAsArrayBuffer`/`readAsText` fires `onload` via `queueMicrotask`, then 
`await Promise.resolve()`); restore the global in `afterEach`. Do not rely on 
jsdom's real async timing.
   
   **FilesUploaderComponent** 
(`frontend/src/app/dashboard/component/user/files-uploader/files-uploader.component.ts`,
 ~85%, 10 lines)
   - The uncovered lines are the **promise arms** of the upload/collision flow 
— the `resolve(...)` paths for each user choice and the `reject(...)` path. 
Drive the dialog double so it returns each choice in turn (upload / skip / 
resume / cancel) and assert the promise settles the right way and the queue 
state matches.
   - Cover the guard `if` arms that decide whether the collision prompt is 
shown at all.
   - Keep it synchronous: resolve the mocked dialog with `Promise.resolve(...)` 
and `await` it — no real timers.
   
   **UserComputingUnitComponent** 
(`frontend/src/app/dashboard/component/user/user-computing-unit/user-computing-unit.component.ts`,
 ~75%, 8 lines)
   - The constructor's uncovered setup lines and the `interval`-driven refresh 
registration — assert the subscription is wired (the poller calls the service 
double) and that `ngOnDestroy` tears it down.
   - `terminateComputingUnit` — assert it delegates to the service with the 
right cuid, and cover the guarded/refused arm.
   - Determinism: if the refresh uses a recurring `timer`/`interval`, call 
`fixture.destroy()` in `afterEach` so it stops ticking across tests; **do not** 
layer `vi.useFakeTimers()` over zone.js's patched timers merely to keep a 
callback from firing.
   
   Assert on component state and delegated calls — never on layout or geometry 
(zeros under jsdom).
   
   ### 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]

Reply via email to