Revert "Revert "test: verify auto-update notification flow"" (#479)
* Revert "Revert "test: verify auto-update notification flow" (#478)"
This reverts commit 988fa02456.
* test: fix missing ipc events mock in useIpcEvents.test.ts
* Add usage status bar and Codex account switching (#483)
* 1.1.14
* feat: add active agent count in top bar (#484)
* feat: add active agent count in top bar
* fix: pass missing runtime pane title setters to pty connection
---------
Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
* Add "No login required" to README features (#486)
* Add "No login required" to top of README features
Highlight that Orca needs no account or login — users bring their own
Claude Code or Codex subscription directly.
* Simplify no-login line and add Codex account switching section
- Trim "No login required" to just the essentials
- Add [New] Hot Swap Codex Accounts section with gif demo
* Fix README badge layout — remove blank lines inside HTML blocks (#488)
Blank lines inside <p> tags cause GitHub to render each badge as a
separate paragraph instead of inline on one row.
* Add Codex account switcher gif (#489)
The gif was referenced in README but never committed.
* Refresh worktree quick jump UI (#487)
* fix: Warp-parity keyboard shortcuts — image paste and line-kill bindings (#491)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
* Nicer agent list (#492)
* test: mock more missing IPC handlers and store actions in useIpcEvents tests
---------
Co-authored-by: Jinwoo Hong <73622457+Jinwoo-H@users.noreply.github.com>
Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
Co-authored-by: Yax Patel <74978532+ypatel2022@users.noreply.github.com>
Co-authored-by: Colin Chambachan <colin.chambachan@gmail.com>
Co-authored-by: Ramzi <79337754+heyramzi@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Neil <4138956+nwparker@users.noreply.github.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
Jinwoo Hong
Jinwoo-H
Yax Patel
Colin Chambachan
Ramzi
Neil
parent
16057b82b9
commit
55bc0f8b33
@@ -277,4 +277,43 @@ describe('updater', () => {
|
||||
vi.advanceTimersByTime(60 * 1000)
|
||||
expect(autoUpdaterMock.checkForUpdates).toHaveBeenCalledTimes(2)
|
||||
})
|
||||
|
||||
it('reschedules the next automatic check 36 hours after finding an available update', async () => {
|
||||
vi.useFakeTimers()
|
||||
vi.setSystemTime(new Date('2026-04-03T12:00:00Z'))
|
||||
|
||||
autoUpdaterMock.checkForUpdates.mockImplementation(() => {
|
||||
autoUpdaterMock.emit('checking-for-update')
|
||||
queueMicrotask(() => {
|
||||
autoUpdaterMock.emit('update-available', { version: '1.0.61' })
|
||||
})
|
||||
return Promise.resolve(undefined)
|
||||
})
|
||||
|
||||
const sendMock = vi.fn()
|
||||
const setLastUpdateCheckAt = vi.fn()
|
||||
const mainWindow = { webContents: { send: sendMock } }
|
||||
|
||||
const { setupAutoUpdater } = await import('./updater')
|
||||
|
||||
setupAutoUpdater(mainWindow as never, {
|
||||
getLastUpdateCheckAt: () => null,
|
||||
setLastUpdateCheckAt
|
||||
})
|
||||
|
||||
await vi.runAllTicks()
|
||||
|
||||
expect(autoUpdaterMock.checkForUpdates).toHaveBeenCalledTimes(1)
|
||||
expect(setLastUpdateCheckAt).toHaveBeenCalledTimes(1)
|
||||
expect(sendMock).toHaveBeenCalledWith('updater:status', {
|
||||
state: 'available',
|
||||
version: '1.0.61'
|
||||
})
|
||||
|
||||
vi.advanceTimersByTime(35 * 60 * 60 * 1000 + 59 * 60 * 1000)
|
||||
expect(autoUpdaterMock.checkForUpdates).toHaveBeenCalledTimes(1)
|
||||
|
||||
vi.advanceTimersByTime(60 * 1000)
|
||||
expect(autoUpdaterMock.checkForUpdates).toHaveBeenCalledTimes(2)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import type * as ReactModule from 'react'
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { resolveZoomTarget } from './useIpcEvents'
|
||||
|
||||
function makeTarget(args: { hasXtermClass?: boolean; editorClosest?: boolean }): {
|
||||
@@ -55,3 +56,136 @@ describe('resolveZoomTarget', () => {
|
||||
).toBe('ui')
|
||||
})
|
||||
})
|
||||
|
||||
describe('useIpcEvents updater integration', () => {
|
||||
beforeEach(() => {
|
||||
vi.resetModules()
|
||||
vi.unstubAllGlobals()
|
||||
})
|
||||
|
||||
it('routes updater status events into store state and update toasts', async () => {
|
||||
const setUpdateStatus = vi.fn()
|
||||
const handleStatus = vi.fn()
|
||||
const updaterStatusListenerRef: { current: ((status: unknown) => void) | null } = {
|
||||
current: null
|
||||
}
|
||||
|
||||
vi.doMock('react', async () => {
|
||||
const actual = await vi.importActual<typeof ReactModule>('react')
|
||||
return {
|
||||
...actual,
|
||||
useEffect: (effect: () => void | (() => void)) => {
|
||||
effect()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
vi.doMock('../store', () => ({
|
||||
useAppStore: {
|
||||
getState: () => ({
|
||||
setUpdateStatus,
|
||||
fetchRepos: vi.fn(),
|
||||
fetchWorktrees: vi.fn(),
|
||||
setActiveView: vi.fn(),
|
||||
activeModal: null,
|
||||
closeModal: vi.fn(),
|
||||
openModal: vi.fn(),
|
||||
activeWorktreeId: 'wt-1',
|
||||
activeView: 'terminal',
|
||||
setActiveRepo: vi.fn(),
|
||||
setActiveWorktree: vi.fn(),
|
||||
revealWorktreeInSidebar: vi.fn(),
|
||||
setIsFullScreen: vi.fn(),
|
||||
updateBrowserTabPageState: vi.fn(),
|
||||
activeTabType: 'terminal',
|
||||
editorFontZoomLevel: 0,
|
||||
setEditorFontZoomLevel: vi.fn(),
|
||||
setRateLimitsFromPush: vi.fn(),
|
||||
settings: { terminalFontSize: 13 }
|
||||
})
|
||||
}
|
||||
}))
|
||||
|
||||
vi.doMock('./update-toast-controller', () => ({
|
||||
createUpdateToastController: () => ({
|
||||
handleStatus
|
||||
})
|
||||
}))
|
||||
|
||||
vi.doMock('@/lib/ui-zoom', () => ({
|
||||
applyUIZoom: vi.fn()
|
||||
}))
|
||||
vi.doMock('@/lib/worktree-activation', () => ({
|
||||
activateAndRevealWorktree: vi.fn(),
|
||||
ensureWorktreeHasInitialTerminal: vi.fn()
|
||||
}))
|
||||
vi.doMock('@/components/sidebar/visible-worktrees', () => ({
|
||||
getVisibleWorktreeIds: () => []
|
||||
}))
|
||||
vi.doMock('@/lib/editor-font-zoom', () => ({
|
||||
nextEditorFontZoomLevel: vi.fn(() => 0),
|
||||
computeEditorFontSize: vi.fn(() => 13)
|
||||
}))
|
||||
vi.doMock('@/components/settings/SettingsConstants', () => ({
|
||||
zoomLevelToPercent: vi.fn(() => 100),
|
||||
ZOOM_MIN: -3,
|
||||
ZOOM_MAX: 3
|
||||
}))
|
||||
vi.doMock('@/lib/zoom-events', () => ({
|
||||
dispatchZoomLevelChanged: vi.fn()
|
||||
}))
|
||||
|
||||
vi.stubGlobal('window', {
|
||||
api: {
|
||||
repos: { onChanged: () => () => {} },
|
||||
worktrees: { onChanged: () => () => {} },
|
||||
ui: {
|
||||
onOpenSettings: () => () => {},
|
||||
onToggleWorktreePalette: () => () => {},
|
||||
onOpenQuickOpen: () => () => {},
|
||||
onJumpToWorktreeIndex: () => () => {},
|
||||
onActivateWorktree: () => () => {},
|
||||
onNewBrowserTab: () => () => {},
|
||||
onNewTerminalTab: () => () => {},
|
||||
onCloseActiveTab: () => () => {},
|
||||
onSwitchTab: () => () => {},
|
||||
onToggleStatusBar: () => () => {},
|
||||
onFullscreenChanged: () => () => {},
|
||||
onTerminalZoom: () => () => {},
|
||||
getZoomLevel: () => 0,
|
||||
set: vi.fn()
|
||||
},
|
||||
updater: {
|
||||
getStatus: () => Promise.resolve({ state: 'idle' }),
|
||||
onStatus: (listener: (status: unknown) => void) => {
|
||||
updaterStatusListenerRef.current = listener
|
||||
return () => {}
|
||||
}
|
||||
},
|
||||
browser: {
|
||||
onGuestLoadFailed: () => () => {}
|
||||
},
|
||||
rateLimits: {
|
||||
get: () => Promise.resolve({ limits: {}, lastUpdatedAt: Date.now() }),
|
||||
onUpdate: () => () => {}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const { useIpcEvents } = await import('./useIpcEvents')
|
||||
|
||||
useIpcEvents()
|
||||
await Promise.resolve()
|
||||
|
||||
expect(setUpdateStatus).toHaveBeenCalledWith({ state: 'idle' })
|
||||
|
||||
const availableStatus = { state: 'available', version: '1.2.3' }
|
||||
if (typeof updaterStatusListenerRef.current !== 'function') {
|
||||
throw new Error('Expected updater status listener to be registered')
|
||||
}
|
||||
updaterStatusListenerRef.current(availableStatus)
|
||||
|
||||
expect(setUpdateStatus).toHaveBeenCalledWith(availableStatus)
|
||||
expect(handleStatus).toHaveBeenCalledWith(availableStatus)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user