fix(desktop): restore locale provider test mocks

Merged
KI
2mo ago
+22-2

What & why

Running the locale-provider suite before the terminal transport suite leaves a PostHog mock without capture, causing five terminal tests to fail. Its auth mock also removes ensureFreshJwt when those suites run together without preloading auth.

Preserve the auth and PostHog module exports, override only the locale test dependencies through proxies, and restore both modules in afterAll. This changes test setup only.

How I tested it

  • Reproduced all five CI failures with the locale-provider and terminal suites together (preloading auth to reach the PostHog failures).
  • After the fix, both suites pass together without an auth preload: 35 passed, 0 failed.
  • Root lint and desktop typecheck passed.
  • Full desktop run: 7,552 passed, 36 failed. The baseline already had 34 local failures; this run also hit two host-reachability timing failures. No terminal transport failures. Both host-reachability tests passed when rerun in isolation.

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • Root lint and affected desktop typecheck pass
  • Same-repository PR; maintainer edits available

Summary by CodeRabbit

  • Tests
    • Updated test module mocking to preserve the real authentication and analytics behavior while overriding only the scenarios required by the test.
    • Added cleanup to restore the original module implementations after testing.