• Aryan Noshirvnai's avatar
    Add a real test suite and CI/CD for the webapp · c5510a27
    Aryan Noshirvnai authored
    Nothing existed before this - first tests for the project. Vitest +
    React Testing Library (jsdom environment), all explicit imports (no
    reliance on injected globals, even though globals: true is set).
    
    Coverage, prioritized by actual risk rather than 100%-for-its-own-sake:
    - client.ts (highest value): auth header injection, json/form body
      serialization, error parsing, and - the trickiest logic in the app -
      the 401-refresh-and-retry flow, including that concurrent 401s share a
      single in-flight refresh instead of each firing their own, and that a
      failed refresh doesn't loop.
    - jwt.ts: real base64url decode (not a simplified stand-in), including
      the -/_ substitution path standard base64 doesn't need.
    - AuthContext: the dev auto-login bypass specifically - doesn't
      auto-authenticate without configured tokens, does with them, doesn't
      clobber an already-real session, and logout actually clears state.
      Uses vi.resetModules() + dynamic import per test since DEV_ACCESS_TOKEN
      is captured as a module-level const at import time, so env stubs set
      after the module already loaded would silently do nothing.
    - UI primitives (Button/ProgressBar/EmptyState): rendering + interaction.
    - Library page: empty state, list rendering, error display, and the
      play/pause flow including that pausing doesn't re-fetch the stream.
    
    jsdom needed two stubs in test/setup.ts: HTMLMediaElement.play/pause
    (Library calls these for real) and URL.createObjectURL/revokeObjectURL
    (jsdom has no real object URL storage) - both throw "Not implemented"
    without them.
    
    .gitlab-ci.yml: deliberately minimal after everything the backend's
    pipeline taught this session - no Docker, no apt-get, just
    npm ci -> tsc -> vitest -> vite build on node:20-slim. Verified locally:
    npm ci works cleanly against the lockfile (real risk after many
    incremental npm installs), and the exact CI command sequence passes
    end to end.
    Co-Authored-By: 's avatarClaude Sonnet 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
    c5510a27
Name
Last commit
Last update
..
Channels.tsx Loading commit data...
Discovery.tsx Loading commit data...
Library.test.tsx Loading commit data...
Library.tsx Loading commit data...
Remix.tsx Loading commit data...
Rooms.tsx Loading commit data...
Upload.tsx Loading commit data...