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

   ### What changes were proposed in this PR?
   
   Extends two related workspace service specs
   
(`frontend/src/app/common/service/computing-unit/computing-unit-status/computing-unit-status.service.ts`,
   
`frontend/src/app/workspace/service/workflow-websocket/workflow-websocket.service.ts`)
   to cover the state-management, polling and connection logic they had left
   untested. No production code was changed.
   
   **`ComputingUnitStatusService`** (+5 tests)
   
   - `updateUnitInList` — replaces the matching unit and leaves the others 
untouched;
   - `setComputingUnitsState` — refreshes the selected unit when it is still 
present,
     and clears the selection + stops polling when the selected unit disappears;
   - `startPollingSelectedUnit` — with `vi.useFakeTimers()`, re-fetches the 
unit on
     each interval tick and merges the result; `stopPollingSelectedUnit` halts 
further
     polling (real timers restored in a `finally`).
   
   **`WorkflowWebsocketService`** (+3 tests)
   
   - `websocketEvent` — surfaces events pushed onto the response stream;
   - `getConnectionStatusStream` / `updateConnectionStatus` — reflect 
connect/disconnect
     transitions and guard duplicate values;
   - `openWebsocket` — routes an incoming socket message to `websocketEvent` 
and marks
     the connection up, driven through a fake `window.WebSocket` (the spec's 
existing
     test double), so no real socket is opened.
   
   ### Any related issues, documentation, discussions?
   
   Closes #6754
   
   ### How was this PR tested?
   
   Extended unit tests, run locally in `frontend/` (all green; the failure path 
was
   verified by breaking the polling and connection assertions to confirm the 
suite
   goes red):
   
   ```
   ng test --watch=false --include 
src/app/common/service/computing-unit/computing-unit-status/computing-unit-status.service.spec.ts
   # 18 passed
   ng test --watch=false --include 
src/app/workspace/service/workflow-websocket/workflow-websocket.service.spec.ts 
                    # 6 passed
   prettier --write <specs>   # clean
   eslint  <specs>            # clean
   ```
   
   ### 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