mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 00:57:45 +00:00
test: remove shallow checks and repair persistence and mobile oracles (#33239)
Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
@@ -180,17 +180,4 @@ describe('useRemotePushCapableHosts', () => {
|
||||
await answer('host-1', [CAPABILITY])
|
||||
expect(latest).toEqual({ supported: true, resolved: true })
|
||||
})
|
||||
|
||||
it('ignores an answer from a host the catalog no longer lists', async () => {
|
||||
await mount()
|
||||
await setClients([
|
||||
{ hostId: 'host-ghost', client: clientFor('host-ghost'), state: 'connected' }
|
||||
])
|
||||
|
||||
await answer('host-ghost', [CAPABILITY])
|
||||
|
||||
// An unpaired desktop cannot push to this phone, so its vote must not offer
|
||||
// the switch — nor count as the answer that resolves the section.
|
||||
expect(latest).toEqual({ supported: false, resolved: false })
|
||||
})
|
||||
})
|
||||
|
||||
@@ -97,7 +97,7 @@ describe('MobileOnboardingPage', () => {
|
||||
const callbacks = await renderPage('session-view')
|
||||
|
||||
act(() => button('Open sessions in Chat UI').props.onPress())
|
||||
expect(callbacks.onSessionChoice).toHaveBeenCalledWith('chat')
|
||||
expect(callbacks.onSessionChoice).toHaveBeenCalledExactlyOnceWith('chat')
|
||||
expect(callbacks.onNotificationChoice).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ describe('NotificationOnboardingPreview', () => {
|
||||
})
|
||||
|
||||
it('does not animate the banners when the page is off-screen', async () => {
|
||||
mocks.reducedMotion = false
|
||||
await renderPreview(false)
|
||||
expect(mocks.loop).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
@@ -65,7 +65,7 @@ describe('AppUpdateSettingsRows', () => {
|
||||
'Last checked 2h ago'
|
||||
])
|
||||
act(() => pressables[0].props.onPress())
|
||||
expect(onUpdate).toHaveBeenCalledTimes(1)
|
||||
expect(onUpdate).toHaveBeenCalledExactlyOnceWith('https://example.test')
|
||||
})
|
||||
|
||||
it('shows a plain, untappable version row when current, and Never before a first success', () => {
|
||||
|
||||
@@ -153,7 +153,7 @@ describe('shared settings screen state', () => {
|
||||
// Without the request-epoch fence the stale read would flip the switch back on.
|
||||
expect(switchProps().value).toBe(false)
|
||||
})
|
||||
it('does not enable notifications after denied OS permission', async () => {
|
||||
it('does not enable notifications when permission is not granted', async () => {
|
||||
const denied = {
|
||||
granted: false,
|
||||
status: 'undetermined',
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { VoiceSettingsOperations } from './voice-settings-operations'
|
||||
|
||||
// Why: the sibling state test stubs the poller, so it can only prove the screen's local
|
||||
// machine. This one runs the real useDictationSetupPoller, whose refreshNow is gated on
|
||||
// visible && foreground, to prove the rejected-save recovery actually reaches the wire.
|
||||
// visible && foreground, to prove rejected-save recovery reaches the load operation.
|
||||
vi.mock('react-native', () => ({
|
||||
View: 'View',
|
||||
Text: 'Text',
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ describe('Store native-chat tab viewMode persistence', () => {
|
||||
})
|
||||
|
||||
// Preserve absent viewMode for legacy tabs; renderer hydration supplies terminal mode.
|
||||
it('round-trips viewMode for unified tabs and defaults legacy tabs to terminal', async () => {
|
||||
it('loads chat viewMode and preserves missing legacy viewMode', async () => {
|
||||
const WORKTREE = 'repo1::/worktree'
|
||||
writeDataFile({
|
||||
schemaVersion: 1,
|
||||
|
||||
@@ -22,7 +22,7 @@ describe('normalizeRightSidebarTab', () => {
|
||||
}
|
||||
)
|
||||
|
||||
it('preserves the folder-only pr-checks tab across restarts', () => {
|
||||
it('preserves the folder-only pr-checks tab', () => {
|
||||
expect(normalizeRightSidebarTab('pr-checks')).toBe('pr-checks')
|
||||
})
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ describe('Store', () => {
|
||||
expect(updated.branchPrefix).toBe('git-username')
|
||||
})
|
||||
|
||||
it('persists the agent skill sharing capability as an exact boolean', async () => {
|
||||
it('normalizes the agent skill sharing capability to an exact boolean', async () => {
|
||||
const store = await createStore()
|
||||
|
||||
expect(store.updateSettings({ agentSkillSharingEnabled: true }).agentSkillSharingEnabled).toBe(
|
||||
|
||||
@@ -119,6 +119,7 @@ describe('migrateLegacyOpenCodeGoApiKey', () => {
|
||||
expect(migrateLegacyOpenCodeGoApiKey(secrets, store)).toBe(true)
|
||||
expect(store.save).not.toHaveBeenCalled()
|
||||
expect(store.value()).toBe('fake-current-key')
|
||||
expect(secrets.sealedBlob(LEGACY_OPENCODE_GO_API_KEY_SLOT)).toBeNull()
|
||||
expect(secretStore.decryptString).not.toHaveBeenCalled()
|
||||
expect(console.warn).toHaveBeenCalledWith(
|
||||
'[opencode-go] Kept the existing saved API key and dropped the one from settings.'
|
||||
|
||||
@@ -63,5 +63,13 @@ describe('normalizeLoadedProjectCatalog', () => {
|
||||
const result = normalizeLoadedProjectCatalog({}, vi.fn())
|
||||
expect(result.projects).toEqual([])
|
||||
expect(result.projectHostSetups).toEqual([])
|
||||
const malformed = corrupt(makeParsed([], []), {
|
||||
projects: 'not-an-array',
|
||||
projectHostSetups: {}
|
||||
})
|
||||
expect(normalizeLoadedProjectCatalog(malformed, vi.fn())).toEqual({
|
||||
projects: [],
|
||||
projectHostSetups: []
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -8,9 +8,6 @@ import type { TerminalTab } from '../../../../shared/terminal-tab-types'
|
||||
import type { Worktree } from '../../../../shared/worktree/types'
|
||||
import type { TabEntryOption } from './tab-create-entry-action'
|
||||
import type { TabAgentLaunchOption } from './tab-agent-launch-options'
|
||||
// Unmocked on purpose: the empty-query message must stay in step with the
|
||||
// placeholder rendered below.
|
||||
import { getTabEntryOptions as classifyTabEntryOptions } from './tab-create-entry-classifier'
|
||||
import { TooltipProvider } from '@/components/ui/tooltip'
|
||||
import { useAppStore } from '@/store'
|
||||
import type { AppState } from '@/store/types'
|
||||
@@ -310,20 +307,6 @@ describe('TabBarCreateEntry keyboard navigation', () => {
|
||||
expect(input.getAttribute('aria-label')).toBe(placeholder)
|
||||
})
|
||||
|
||||
it('states the same thing in the empty-query message as in the placeholder', () => {
|
||||
mount(<TabBarCreateEntry worktreeId="wt" groupId="g" menuOpen onOpenEntry={vi.fn()} />)
|
||||
|
||||
const [emptyOption] = classifyTabEntryOptions('', {
|
||||
files: [],
|
||||
loading: false,
|
||||
loadError: null
|
||||
})
|
||||
expect(emptyOption.classification).toMatchObject({ kind: 'empty' })
|
||||
expect(
|
||||
emptyOption.classification.kind === 'empty' ? emptyOption.classification.message : null
|
||||
).toBe(container.querySelector('input')!.getAttribute('placeholder'))
|
||||
})
|
||||
|
||||
it('offers no switch rows when the menu opens with tabs open and no query', () => {
|
||||
seedOpenTabs()
|
||||
mount(
|
||||
|
||||
@@ -31,13 +31,6 @@ describe('TabStripScrollIndicator', () => {
|
||||
expect(indicator.className).toContain('opacity-0')
|
||||
})
|
||||
|
||||
it('applies pointer-events-none when disabled', () => {
|
||||
const { getByTestId } = render(<TabStripScrollIndicator hasOverflow disabled={true} />)
|
||||
const indicator = getByTestId('tab-strip-scroll-indicator')
|
||||
expect(indicator.className).toContain('pointer-events-none')
|
||||
expect(indicator.className).not.toContain('group-hover/tab-strip:pointer-events-auto')
|
||||
})
|
||||
|
||||
it('stays hidden and unexpanded on hover when disabled', () => {
|
||||
const { getByTestId } = render(<TabStripScrollIndicator hasOverflow disabled={true} />)
|
||||
const indicator = getByTestId('tab-strip-scroll-indicator')
|
||||
@@ -113,6 +106,7 @@ describe('TabStripScrollIndicator', () => {
|
||||
expect(scrollToMock).toHaveBeenCalledTimes(1)
|
||||
expect(scrollToMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
left: 300,
|
||||
behavior: 'smooth'
|
||||
})
|
||||
)
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
MAX_FEEDBACK_IMAGE_BYTES,
|
||||
MAX_FEEDBACK_IMAGE_COUNT,
|
||||
MAX_FEEDBACK_IMAGE_TOTAL_BYTES
|
||||
} from './feedback-image-limits'
|
||||
import { MAX_FEEDBACK_IMAGE_BYTES, MAX_FEEDBACK_IMAGE_TOTAL_BYTES } from './feedback-image-limits'
|
||||
|
||||
// Why: the exact value is a judgement call, staying under the host's limit is
|
||||
// not. https://www.onorca.dev/v1/feedback is a Vercel Function and rejects
|
||||
@@ -19,8 +15,4 @@ describe('feedback image limits', () => {
|
||||
it('cannot let one image exceed the whole budget', () => {
|
||||
expect(MAX_FEEDBACK_IMAGE_BYTES).toBeLessThanOrEqual(MAX_FEEDBACK_IMAGE_TOTAL_BYTES)
|
||||
})
|
||||
|
||||
it('leaves room for more than one attachment', () => {
|
||||
expect(MAX_FEEDBACK_IMAGE_COUNT).toBeGreaterThan(1)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user