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

   ### Task Summary
   
   Two auth-layer services (`common/service/user`) whose specs leave the 
login/registration/token paths partly untested. Extend both with 
`HttpClientTestingModule`. jsdom/Vitest; see `frontend/TESTING.md`.
   
   ### Behavior to add
   
   **UserService** (`frontend/src/app/common/service/user/user.service.ts`, 
codecov ~59% — EXTEND)
   - Pure state: `isLogin` / `isAdmin` — reflect the current user (logged-out, 
normal, admin). `changeUser` / `userChanged` — set the current user and emit on 
the change stream.
   - Auth flows: `login` / `register` / `googleLogin` — assert the HTTP request 
(method + URL + body) and that a successful response sets the current user via 
`handleAccessToken`. `logout` clears it. `getCurrentUser` returns the held user.
   - `getAvatar` / `fetchBlob` — assert the request and returned blob (use 
`HttpTestingController`; flush synchronously, never a real backend).
   
   **AuthService** (`frontend/src/app/common/service/user/auth.service.ts`, 
codecov ~71% — EXTEND)
   - `auth` / `googleAuth` / `register` / `submitRegistration` — assert the 
HTTP request shape and token handling.
   - `loginWithExistingToken` — resolves the current session from a stored 
token; `logout` clears it.
   - `checkRegistrationRequired` / `openRegistrationModal` — the 
registration-gating branch (assert the modal opens / the flag).
   - `registerAutoLogout` — schedules logout at token expiry. Use 
`vi.useFakeTimers()` so the scheduled timer is controlled and never fires 
real-time (deterministic); assert the logout is scheduled/invoked on advance, 
and restore real timers in `afterEach`.
   
   ### 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