Skip to content

Fix CI: repair vitest test suite (inherited from upstream)#2

Merged
mairas merged 2 commits into
mainfrom
fix/ci-test-failures
Jun 30, 2026
Merged

Fix CI: repair vitest test suite (inherited from upstream)#2
mairas merged 2 commits into
mainfrom
fix/ci-test-failures

Conversation

@mairas

@mairas mairas commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Why

CI on the fork is red. Investigation shows the failures are inherited from upstream (mxtommy/kip's own master CI is red since ~2026-05-13) — the karma→vitest migration left the suite broken. None are caused by the fork, the rebrand, or the logo.

Root causes & fixes

  1. Real bugSettingsService.loadConfigFromLocalStorage did JSON.parse(localStorage.getItem(type) ?? ''); JSON.parse('') throws instead of yielding null, so an empty/missing config slot crashed SettingsService construction (cascading into ~16 "should create" failures, and affecting real first-run users). Fixed → ?? 'null', matching the sibling at line 744. Upstreamable.
  2. Stub driftSettingsServiceStub (test.ts) lacked methods the real service gained (get/setDisablePathValidation, get/setWidgetHistoryDisabled, setNightModeBrightness, setSplitShellSwipeDisabled) → display & path-control specs hit "is not a function". Added them.
  3. widget.service.spec asserted widget-inverter/-alternator/-ac, which are commented out in widget.service.ts. Aligned the test to the registered set (solar-charger, charger).
  4. login.component.specngOnInit opens a credential dialog; with no MatDialog mock, afterClosed() was undefined. Mocked MatDialog.

None of these change application behaviour (except fix 1, which is a genuine robustness fix).

Verification

Local env can't reproduce CI (its jsdom lacks localStorage due to a lockfile-drift version mismatch), so CI is the oracle — see the checks on this PR.

🤖 Generated with Claude Code

loadConfigFromLocalStorage parsed `localStorage.getItem(type) ?? ''`,
but `JSON.parse('')` throws "Unexpected end of JSON input" instead of
yielding null — so a missing slot crashed SettingsService construction
(e.g. first run with empty storage) rather than falling through to the
defaults the next line already handles. Use `?? 'null'`, matching the
sibling pattern at line 744.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mairas mairas force-pushed the fix/ci-test-failures branch from b95f441 to 13baafb Compare June 30, 2026 20:32
The karma->vitest migration left several specs red (upstream CI is red
too). Fixes, none of which change app behaviour:
- SettingsServiceStub (test.ts): add the path-validation / widget-history
  / night-mode / split-shell-swipe setters the real service gained.
- widget.service.spec: assert the electrical widgets actually registered
  (solar-charger, charger); alternator/inverter/ac are commented out in
  widget.service.ts pending readiness.
- login.component.spec: mock MatDialog so the credential dialog's
  afterClosed() resolves instead of throwing.
- display.component.spec: add get/setDisablePathValidation to the local
  SettingsServiceMock.
- path-control-config.spec: give the SignalKConnectionService mock a
  serverServiceEndpoint$ so AuthenticationService construction can
  subscribe without crashing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant