diff --git a/mobile/host-web-app/h/[hostId]/index.tsx b/mobile/host-web-app/h/[hostId]/index.tsx new file mode 100644 index 00000000000..7ee025542bd --- /dev/null +++ b/mobile/host-web-app/h/[hostId]/index.tsx @@ -0,0 +1,4 @@ +// Why: shared session code leaves to `/h/` (leaveSession with no history, the +// missing-worktree bounce). The hosted page lists workspaces at `/`, so without this alias +// those exits landed on expo-router's Unmatched Route screen. +export { default } from '../../index' diff --git a/mobile/src/mobile-web/hosted-host-index-route.test.ts b/mobile/src/mobile-web/hosted-host-index-route.test.ts new file mode 100644 index 00000000000..a8350e8ab81 --- /dev/null +++ b/mobile/src/mobile-web/hosted-host-index-route.test.ts @@ -0,0 +1,20 @@ +import { existsSync, readFileSync } from 'node:fs' +import { describe, expect, it } from 'vitest' + +const hostedRoot = new URL('../../host-web-app/', import.meta.url) +const hostIndexRoute = new URL('h/[hostId]/index.tsx', hostedRoot) +const leaveSessionSource = readFileSync( + new URL('../session/use-mobile-session-markdown-actions.ts', import.meta.url), + 'utf8' +) +const bounceSource = readFileSync(new URL('../host-route-notice.ts', import.meta.url), 'utf8') + +describe('hosted host index route', () => { + it('serves the host index that shared session exits navigate to', () => { + // Both exits target /h/; a hosted page without that route renders Unmatched Route. + expect(leaveSessionSource).toContain('router.replace(`/h/${hostId}`)') + expect(bounceSource).toContain('`/h/${encodeURIComponent(hostId)}?notice=${notice}`') + expect(existsSync(hostIndexRoute)).toBe(true) + expect(readFileSync(hostIndexRoute, 'utf8')).toContain("export { default } from '../../index'") + }) +})