Fix the app tests that keep main red (LocalFtp, App) #107

Merged
spark merged 3 commits from task/main-red-app-tests into main 2026-10-21 22:53:51 +01:00
Owner

main is red in the typescript job: apps/app has 9 failing tests (run 22981 and the earlier ones), and that is what makes #90, #91 and #95 red.

Cause (from the CI log of run 22981, job 54139, and reproduced locally):

  • LocalFtp.test.tsx: since 54c40bd, useLocalFtp reads the client with useAuth(). The test renders the hook with no AuthProvider, so all 7 cases throw useAuth outside AuthProvider.
  • App.test.tsx: the same commit made useOfflineSync (mounted by App) call onSocketLive() from library/realtime. The test mock of that module only returned useLibraryLive, so the effect threw (No "onSocketLive" export is defined on the mock), the tree unmounted, and the sign-in and editor panel cases could not find their text.

Fix: only the two test mocks change. ../auth.js is mocked with a bare client (same pattern as FacesQueuePage.test.tsx), and the realtime mock now returns a no-op onSocketLive. No test is skipped and no product code changes.

Checked locally: apps/app typecheck passes, and vitest passes all 43 files and 148 tests (on main, 9 fail).

Update (2c77135): after main took #111 (899b45f, EHF), apps/api test/sports.test.ts also went red on main. refreshDue now reads the six EHF club competitions, and the test's fake sites answered 404 for *.eurohandball.com (6 errors). The fake now serves an EHF season page with empty match lists, and the expected competitions list includes the six EHF entries. Checked locally against the same fake: EhfProvider.matches returns [] with no errors for all six. The API tests need Postgres with pgvector, so CI runs the full suite.

`main` is red in the **typescript** job: `apps/app` has 9 failing tests (run 22981 and the earlier ones), and that is what makes #90, #91 and #95 red. Cause (from the CI log of run 22981, job 54139, and reproduced locally): - `LocalFtp.test.tsx`: since 54c40bd, `useLocalFtp` reads the client with `useAuth()`. The test renders the hook with no `AuthProvider`, so all 7 cases throw `useAuth outside AuthProvider`. - `App.test.tsx`: the same commit made `useOfflineSync` (mounted by `App`) call `onSocketLive()` from `library/realtime`. The test mock of that module only returned `useLibraryLive`, so the effect threw (`No "onSocketLive" export is defined on the mock`), the tree unmounted, and the sign-in and editor panel cases could not find their text. Fix: only the two test mocks change. `../auth.js` is mocked with a bare client (same pattern as `FacesQueuePage.test.tsx`), and the `realtime` mock now returns a no-op `onSocketLive`. No test is skipped and no product code changes. Checked locally: `apps/app` typecheck passes, and vitest passes all 43 files and 148 tests (on main, 9 fail). **Update (2c77135):** after main took #111 (899b45f, EHF), `apps/api` `test/sports.test.ts` also went red on main. `refreshDue` now reads the six EHF club competitions, and the test's fake sites answered 404 for `*.eurohandball.com` (6 errors). The fake now serves an EHF season page with empty match lists, and the expected competitions list includes the six EHF entries. Checked locally against the same fake: `EhfProvider.matches` returns `[]` with no errors for all six. The API tests need Postgres with pgvector, so CI runs the full suite.
spark added 1 commit 2026-10-21 21:38:03 +01:00
Fix the app tests that keep main red since the offline sync landed
ci / rust (pull_request) Successful in 14m50s
ci / typescript (pull_request) Failing after 15m20s
ce306a7642
54c40bd made useLocalFtp read the signed-in client with useAuth() and made
useOfflineSync (mounted by App) subscribe through onSocketLive() from
library/realtime. The tests were not updated:

- LocalFtp.test.tsx renders the hook with no AuthProvider, so every case
  threw "useAuth outside AuthProvider". It now mocks ../auth.js with a bare
  client, the same way FacesQueuePage.test.tsx does. The target has no
  organization, so the offline flush and local autopilot never call it.
- App.test.tsx mocks ./library/realtime.js without onSocketLive. The sync
  effect threw, unmounted the tree and the sign-in and editor panel cases
  could not find their text. The mock now returns a no-op subscription.

No test is skipped and no product code changes.
spark added 1 commit 2026-10-21 22:12:38 +01:00
Merge branch 'main' into task/main-red-app-tests
ci / rust (pull_request) Successful in 13m20s
ci / typescript (pull_request) Failing after 14m35s
cf2e466549
Member

@cto — Gitea autopilot needs a CTO decision on BitReport.pt/photoreport#107: CI is red on the PR head.

  • Head: cf2e466549c0
  • Detail: failed contexts: ci / typescript (pull_request)
  • The bot did not approve or schedule a merge for this head.
  • Fix the branch, approve as CTO, or close the PR. The bot re-checks on the next run.
@cto — Gitea autopilot needs a CTO decision on BitReport.pt/photoreport#107: CI is red on the PR head. - Head: `cf2e466549c0` - Detail: failed contexts: ci / typescript (pull_request) - The bot did **not** approve or schedule a merge for this head. - Fix the branch, approve as CTO, or close the PR. The bot re-checks on the next run. <!-- gitea-autopilot-escalation kind=ci_failure sha=cf2e466549c0 -->
spark added 1 commit 2026-10-21 22:42:59 +01:00
Let the sports test answer the EHF pages that refreshDue now reads
ci / rust (pull_request) Successful in 4m51s
ci / typescript (pull_request) Successful in 8m31s
2c77135e7a
899b45f (#111) added the six EHF club competitions to the catalog and to
refreshDue. The fake sites in test/sports.test.ts did not know
*.eurohandball.com, so every EHF season page answered 404, refreshDue
returned six errors and "reads the Liga and FPA, and only again after six
hours" failed on main.

The fake now serves an EHF season page with its ids and empty match lists,
and the expected competitions include the six EHF ones (no fixtures yet).
spark merged commit 06a4a9dd4a into main 2026-10-21 22:53:51 +01:00
Sign in to join this conversation.