mengw15 opened a new pull request, #6390: URL: https://github.com/apache/texera/pull/6390
### What changes were proposed in this PR? Adds a Vitest unit-test suite for `frontend/src/app/hub/service/hub.service.ts` (`HubService`), which previously had no spec (~30% coverage). `HubService` is a thin `HttpClient` wrapper with ~10 `Observable`-returning methods; the suite asserts each issues the expected request (method, URL, query params / body, headers) and maps the response, using `HttpClientTestingModule` + `HttpTestingController` — no backend. 15 tests cover: - `getCount` — GET `/count` with the `entityType` param → emits the count. - `cloneWorkflow` — POST `/workflow/clone/:wid` with a null body → emits the new wid. - `isLiked` — GET `/isLiked` appending every id/type → emits `LikedStatus[]`. - `postLike` / `postUnlike` — POST `/like` / `/unlike` with the json body/header → emit the boolean. - `toggleLike` — three cases: not-liked → likes then re-fetches the count; liked → unlikes then re-fetches; action returns `false` → state unchanged and the count defaults to 0. - `postView` — POST `/view` with the json body → emits the view count. - `getTops` — GET `/getTops` with `entityType`/`uid`/`limit`/appended `actionTypes`, plus the `uid` = -1 default and `limit`-omitted path. - `getCounts` — GET `/counts` appending types/ids/actionTypes, plus the empty-`actionTypes` (param omitted) path. - `getUserAccess` — GET `/user-access` appending types/ids → emits `AccessResponse[]`. No production code was changed. ### Any related issues, documentation, discussions? Closes #6387 ### How was this PR tested? New unit tests, run locally in `frontend/` (all green; the failure path was verified by deliberately breaking an assertion to confirm the suite goes red): ``` ng test --watch=false --include src/app/hub/service/hub.service.spec.ts # Test Files 1 passed (1) | Tests 15 passed (15) prettier --write src/app/hub/service/hub.service.spec.ts # unchanged eslint src/app/hub/service/hub.service.spec.ts # clean ``` The suite uses `HttpClientTestingModule` / `HttpTestingController` (see `frontend/TESTING.md` Recipe E), so it makes no real network calls. ### 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]
