1. 19 Jul, 2026 1 commit
    • Administrator's avatar
      test: seam coverage for auth/authService/endpoints/lanAccess — Candidate 4 · 4bca327d
      Administrator authored
      
      
      Five new spec files take the test count 113 → 178 (+65). Zero
      production code changes; all coverage gain.
      
      - src/__tests__/utils/jwtFactory.js           — base64url JWT maker
      - src/__tests__/utils/authGuard.spec.js       — 21 tests on checkAuth()
                                                     (LAN bypass, already-authed,
                                                      refresh-failed, etc.)
      - src/__tests__/utils/lanAccess.spec.js       — 17 tests on real CIDR
                                                     parser (jsdom hostname
                                                     patching)
      - src/__tests__/api/endpoints.spec.js         — 10 tests, structural
                                                     lock for apiEndpoints
      - src/__tests__/api/authService.spec.js       — 5 tests, login +
                                                     refreshAccessToken HTTP
                                                     shape
      - src/__tests__/stores/authStore.spec.js      — 33 tests, first Pinia
                                                     spec; covers axios
                                                     interceptor 8-branch
                                                     decision tree including
                                                     the LAN GET-bypass that
                                                     had 0 coverage before
      
      Footnotes for future explorers:
      - auth.js reads localStorage at module-eval time to seed its initial
        ref values — vi.stubGlobal('localStorage', ...) installed in
        beforeEach is too late. Manipulate jsdom's real localStorage and
        clear() it in beforeEach instead.
      - The axios response interceptor's logout() call is closure-captured
        at setup time, so external reassignment of auth.logout won't
        intercept it. Assert logout side effects via state changes
        (auth.accessToken === null, etc.) instead.
      Co-Authored-By: default avatarClaude <noreply@anthropic.com>
      4bca327d