Files
orca/src/main/ipc/runtime-environment-diagnostics-broadcast.test.ts
T
mirror 34fa2cd5ca
Skill update round trip / roundtrip (false, macos-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, macos-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, ubuntu-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, ubuntu-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, ubuntu-latest, symlink, latest) (push) Canceled after 0s
Skill update round trip / roundtrip (false, windows-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, windows-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, macos-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, macos-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, ubuntu-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, ubuntu-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, windows-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, windows-latest, symlink, 1.5.17) (push) Canceled after 0s
source snapshot 2026-09-02
2026-09-02 02:03:16 +08:00

41 lines
1.3 KiB
TypeScript

import { beforeEach, describe, expect, it, vi } from 'vitest'
const getAllWindows = vi.hoisted(() => vi.fn())
vi.mock('electron', () => ({ BrowserWindow: { getAllWindows } }))
import {
publishRuntimeEnvironmentDiagnostics,
RUNTIME_ENVIRONMENT_DIAGNOSTICS_CHANNEL
} from './runtime-environment-diagnostics-broadcast'
describe('runtime environment diagnostics broadcast', () => {
beforeEach(() => getAllWindows.mockReset())
it('publishes to live renderer windows and skips destroyed windows', () => {
const live = { isDestroyed: () => false, webContents: { send: vi.fn() } }
const destroyed = { isDestroyed: () => true, webContents: { send: vi.fn() } }
getAllWindows.mockReturnValue([live, destroyed])
const event = {
environmentId: 'env-a',
transportGeneration: 2,
diagnostics: {
state: 'reconnecting' as const,
pendingRequestCount: 0,
subscriptionCount: 1,
reconnectAttempt: 1,
lastConnectedAt: 1,
lastClose: null,
lastError: 'offline'
}
}
publishRuntimeEnvironmentDiagnostics(event)
expect(live.webContents.send).toHaveBeenCalledWith(
RUNTIME_ENVIRONMENT_DIAGNOSTICS_CHANNEL,
event
)
expect(destroyed.webContents.send).not.toHaveBeenCalled()
})
})