test: remove thin mobile forwarding and inventory checks

This commit is contained in:
OrcaWin
2026-11-11 09:41:47 -08:00
parent 8250fc33a8
commit 0c28314331
5 changed files with 1 additions and 139 deletions
@@ -84,9 +84,4 @@ describe('a workspace screen’s router', () => {
['back']
])
})
it('is the plain router in the desktop’s own workspaces', async () => {
const router = await workspaceRouterFor({})
expect(router).toBe(route.router)
})
})
@@ -1,23 +0,0 @@
import { beforeEach, expect, it, vi } from 'vitest'
const requireNativeModule = vi.hoisted(() => vi.fn())
vi.mock('expo-modules-core', () => ({ requireNativeModule }))
beforeEach(() => {
vi.resetModules()
requireNativeModule.mockReset()
})
it('requires the iOS ledger and surfaces a missing native module as a build defect', async () => {
requireNativeModule.mockImplementation(() => {
throw new Error('Cannot find native module OrcaNotificationDismissal')
})
await expect(import('./native-push-dismissal.ios')).rejects.toThrow(
'Cannot find native module OrcaNotificationDismissal'
)
})
it('does not load an iOS module on the default Android/web path', async () => {
expect((await import('./native-push-dismissal')).nativePushDismissal).toBeNull()
expect(requireNativeModule).not.toHaveBeenCalled()
})
@@ -2,7 +2,7 @@ import { createElement, type ReactNode } from 'react'
import { act, create, type ReactTestRenderer } from 'react-test-renderer'
import { afterEach, describe, expect, it, vi } from 'vitest'
import { MobileOnboardingPage } from './MobileOnboardingPage'
import { findAllByHostType, findByHostType } from '../test-support/react-test-renderer-host-nodes'
import { findByHostType } from '../test-support/react-test-renderer-host-nodes'
vi.mock('react-native', async () => {
const React = await import('react')
@@ -87,12 +87,6 @@ describe('MobileOnboardingPage', () => {
)
}
function collectText(): string {
return findAllByHostType(renderer!.root, 'Text')
.flatMap((node) => node.props.children)
.join(' ')
}
it('renders the session choices and sends exactly one selected view', async () => {
const callbacks = await renderPage('session-view')
@@ -109,19 +103,6 @@ describe('MobileOnboardingPage', () => {
expect(callbacks.onSessionChoice).not.toHaveBeenCalled()
})
it('explains that alerts cover finished work and waiting agents, even if the app is closed', async () => {
await renderPage('notifications')
const copy = collectText()
expect(copy).toContain('Don’t miss when an agent needs you')
expect(copy).toContain('finishes or is waiting')
expect(copy).toContain('using the app')
expect(copy).toContain('Enable notifications')
expect(copy).toContain('Codex finished')
expect(copy).toContain('Claude needs input')
expect(renderer!.root.findByProps({ testID: 'notification-onboarding-preview' })).toBeTruthy()
})
it('disables both notification choices while permission is pending', async () => {
await renderPage('notifications', { busyChoice: 'enable' })
const enable = button('Enable agent notifications')
-14
View File
@@ -26,28 +26,14 @@ afterEach(() => {
})
describe('opening a URL from a phone screen', () => {
it('hands it straight to the app, unchanged', () => {
openExternalLink('https://github.com/stablyai/orca/pull/1')
expect(linking.openURL.mock.calls).toEqual([['https://github.com/stablyai/orca/pull/1']])
})
it('does not throw out of a tap handler when nothing can open the URL', async () => {
linking.openURL.mockImplementation(() => Promise.reject(new Error('no activity found')))
expect(() => openExternalLink('mailto:someone@example.com')).not.toThrow()
await Promise.resolve()
})
it('checks no scheme of its own, because on a phone this is what every call site already did', () => {
openExternalLink('orca://x')
expect(linking.openURL.mock.calls).toEqual([['orca://x']])
})
})
describe('a URL the platform refuses before it returns a promise', () => {
it('does not throw out of a tap handler for an empty string', () => {
expect(() => openExternalLink('')).not.toThrow()
})
it('names the refusal rather than failing silently', () => {
const warned = vi.spyOn(console, 'warn').mockImplementation(() => undefined)
openExternalLink('')
-77
View File
@@ -1,77 +0,0 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { BRIDGE_HAPTICS_KINDS } from '../mobile-web-shell/bridge/bridge-haptics-notify'
import {
publishHapticsNotifier,
triggerEdgeBump,
triggerError,
triggerMediumImpact,
triggerSelection,
triggerSuccess
} from './haptics.web'
const asked: string[] = []
beforeEach(() => {
asked.length = 0
publishHapticsNotifier((kind) => {
asked.push(kind)
return true
})
})
afterEach(() => {
vi.restoreAllMocks()
})
describe('the haptic each page function asks the shell for', () => {
it.each([
['mediumImpact', triggerMediumImpact],
['selection', triggerSelection],
['success', triggerSuccess],
['error', triggerError],
['edgeBump', triggerEdgeBump]
] as const)('posts exactly one notify, carrying %s', (kind, trigger) => {
trigger()
expect(asked).toEqual([kind])
})
it('covers every kind the notify accepts, so no name is left on a no-op', () => {
// Check export/kind parity so adding a native haptic cannot silently leave page taps inert.
for (const trigger of [
triggerMediumImpact,
triggerSelection,
triggerSuccess,
triggerError,
triggerEdgeBump
]) {
trigger()
}
expect([...asked].sort()).toEqual([...BRIDGE_HAPTICS_KINDS].sort())
})
it('posts one frame per call, because a scrolling list calls once per row', () => {
for (let row = 0; row < 12; row += 1) {
triggerSelection()
}
expect(asked).toHaveLength(12)
})
})
describe('a shell that will not play it', () => {
it('says nothing, because nobody reads the answer and every row tap would say it again', () => {
const warned = vi.spyOn(console, 'warn').mockImplementation(() => undefined)
publishHapticsNotifier(() => false)
expect(() => triggerSelection()).not.toThrow()
expect(warned).not.toHaveBeenCalled()
})
it('asks nothing at all in a document that published no notifier', async () => {
// Reload the module to clear notifiers published by earlier cases.
vi.resetModules()
const warned = vi.spyOn(console, 'warn').mockImplementation(() => undefined)
const fresh: typeof import('./haptics.web') = await import('./haptics.web')
expect(() => fresh.triggerError()).not.toThrow()
expect(asked).toEqual([])
expect(warned).not.toHaveBeenCalled()
})
})