mirror of
https://github.com/stablyai/orca.git
synced 2026-09-30 08:03:12 +00:00
test(mobile): name the owned shell session type through the app module
The type-aware CI lint resolves the file: shell package as an error type, which turned the ref's union into any and failed the changed-code gate. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
This commit is contained in:
@@ -4,7 +4,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import type { MutableRefObject } from 'react'
|
||||
import type { RpcClient } from '../transport/rpc-client'
|
||||
import type { HostProfile } from '../transport/types'
|
||||
import type { MobileWebShellSession } from '@orca/expo-mobile-web-shell'
|
||||
import type { MobileWebPackageSession } from './mobile-web-package-session-state'
|
||||
|
||||
const native = vi.hoisted(() => ({ openSession: vi.fn(), closeSession: vi.fn() }))
|
||||
const downloadPackage = vi.hoisted(() => vi.fn())
|
||||
@@ -18,6 +18,10 @@ vi.mock('./mobile-web-package-downloader', () => ({
|
||||
|
||||
import { useMobileWebPackageRefresh } from './use-mobile-web-package-refresh'
|
||||
|
||||
// Why: the type-aware CI lint resolves the file: shell package as `error`, so name the
|
||||
// session type through the app module instead of the package.
|
||||
type OwnedSession = NonNullable<MobileWebPackageSession['session']>
|
||||
|
||||
const HOST: HostProfile = {
|
||||
id: 'host-1',
|
||||
name: 'Desktop',
|
||||
@@ -27,7 +31,7 @@ const HOST: HostProfile = {
|
||||
lastConnected: 1
|
||||
}
|
||||
const BUILD_ID = 'a'.repeat(64)
|
||||
const OWNED: MobileWebShellSession = {
|
||||
const OWNED: OwnedSession = {
|
||||
sessionId: 'session-a',
|
||||
buildId: BUILD_ID,
|
||||
url: 'https://session-a.orca-mobile-web.invalid/#session-a'
|
||||
@@ -63,7 +67,7 @@ describe('useMobileWebPackageRefresh', () => {
|
||||
: { commit: { buildId: BUILD_ID }, reusedVerifiedBuild: false }
|
||||
})
|
||||
|
||||
const ownedSessionRef = ref<MobileWebShellSession | null>(OWNED)
|
||||
const ownedSessionRef = ref<OwnedSession | null>(OWNED)
|
||||
function Harness(): null {
|
||||
useMobileWebPackageRefresh({
|
||||
client: { sendRequest: vi.fn() } as unknown as RpcClient,
|
||||
|
||||
Reference in New Issue
Block a user