firstsun-dev_git-files-sync/tests
Claude bcc5cda69c
fix(services): clear error when Git API returns HTML instead of JSON
Refresh failed with the cryptic "Unexpected token '<', "<!DOCTYPE ..."
is not valid JSON" whenever the Git server returned an HTML page (login,
SSO redirect, or proxy/error page) on a 2xx/3xx response. safeRequest
only threw on status >= 400, so such bodies slipped through and crashed
at response.json.

Add BaseGitService.parseJson() which detects non-JSON/HTML bodies and
throws an actionable message, and use it for all response.json reads in
the GitHub and GitLab services. Also harden parseErrorResponse so HTML
error pages produce a clear message instead of dumping the raw document.

Add tests covering HTML 2xx responses, HTML detection by leading '<',
malformed JSON, and HTML error pages.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DwioG4CNKUBuKiZdowLFWe
2026-06-26 06:02:40 +00:00
..
logic refactor(test): eliminate duplicate code flagged by SonarCloud 2026-05-22 03:52:32 +00:00
services fix(services): clear error when Git API returns HTML instead of JSON 2026-06-26 06:02:40 +00:00
ui fix(test): add @types/jsdom and fix Element type cast in setup-dom 2026-05-20 08:59:05 +00:00
utils refactor(test): eliminate duplicate code flagged by SonarCloud 2026-05-22 03:52:32 +00:00
setup.ts test(ui): add interaction tests for ActionBar, FileListItem, and DiffPanel 2026-05-20 05:25:13 +00:00