Skip to content

test(app): mock navigateToSession in the session presentation test - #1864

Open
rophy wants to merge 1 commit into
slopus:mainfrom
rophy:fix/session-presentation-test-mock
Open

rophy wants to merge 1 commit into
slopus:mainfrom
rophy:fix/session-presentation-test-mock

Conversation

@rophy

@rophy rophy commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Summary. sources/components/sessionPresentation.test.ts no longer loads: since 051c228, session/[id]/info.tsx imports navigateToSession from @/hooks/useNavigateToSession, which imports @/track → expo-constants → expo-modules-core, and that fails under vitest with ReferenceError: __DEV__ is not defined. None of the file's 19 tests run. CI does not run the app's unit tests, so it went unnoticed. This PR mocks @/hooks/useNavigateToSession in the test, like its other hook mocks.

Proof (pnpm --filter happy-app exec vitest run sources/components/sessionPresentation.test.ts)

main (dafe9a51):  ReferenceError: __DEV__ is not defined   Tests: no tests
051c2280^:        Tests: 19 passed (19)
this PR:          Tests: 19 passed (19)

Full app suite on this branch: 171 files, 1946 passed, 1 skipped.

info.tsx imports navigateToSession since 051c228, which loads expo-constants through track; unmocked, the test file fails to load with '__DEV__ is not defined'.
@chphch

chphch commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Reproduced and verified on current main (18ae87e):

  • without this PR, sessionPresentation.test.ts fails to load (ReferenceError: __DEV__ is not defined) and none of its 19 tests run
  • with this one line on top of 18ae87e, the file passes 19/19 and the full app suite passes (171 files, 1946 tests, 1 skipped)

This branch has not been deployed

No deployments
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.

2 participants