mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 21:04:23 +01:00
* fix: enable swipe-back suspension on more drawer and remove unused variable * refactor(frontend): improve dialog component and settings navigation * fix: disable route swipe suspension in MoreDrawer to prevent unintended navigation * fix(frontend): enable swipe-back suspension on more drawer route * refactor(frontend): improve mobile navigation drawer and tab bar * feat: add schedules service and workspace hook with navigation updates * chore: add workspace hook, schedules library, and tests * fix: prevent MoreDrawer sentinel from undoing navigation * feat: per-agent model selection and UI refinements (#217) * feat: per-agent model selection and UI refinements - Add agentModels store with setAgentModel/getAgentModel - PromptInput uses session model priority and stores agent model on change - useContextUsage derives model from assistant message instead of global - Migrate sub-agent/subtask badges from purple to blue with refined styling - Fix MoreDrawer sentinel to skip history-back on navigation * refactor: improve per-agent model selection and task tool call status indicators * feat: add repo management skill and internal repos API * fix: improve assistant session launcher and UI components * fix: update atomic-json test assertions * refactor: split Assistant Mode instructions between AGENTS.md and assistant.md * loop: todo-header-mobile completed after 3 iterations (#218) * loop: stt-perf-1 completed after 5 iterations * fix: load audio worklet per recording context * fix: canonicalize assistant navigation routes * fix: adjust scroll-up threshold for header visibility * fix: update settings and skills handling with assistant redirect * refactor: simplify context usage indicator and extract token sum helper * feat: add currently selected model row to popover and fix responsive truncate
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import { describe, it, expect, vi } from 'vitest'
|
|
import { DEFAULTS } from '@opencode-manager/shared/config'
|
|
|
|
const { HEARTBEAT_INTERVAL_MS } = DEFAULTS.SSE
|
|
|
|
describe('SSE Routes', () => {
|
|
describe('HEARTBEAT_INTERVAL_MS', () => {
|
|
it('should be 30000ms (30 seconds)', () => {
|
|
expect(HEARTBEAT_INTERVAL_MS).toBe(30000)
|
|
})
|
|
|
|
it('should fire heartbeats at correct interval', async () => {
|
|
vi.useFakeTimers()
|
|
|
|
const heartbeatSpy = vi.fn()
|
|
const intervalId = setInterval(() => {
|
|
heartbeatSpy()
|
|
}, HEARTBEAT_INTERVAL_MS)
|
|
|
|
await vi.advanceTimersByTimeAsync(0)
|
|
expect(heartbeatSpy).toHaveBeenCalledTimes(0)
|
|
|
|
await vi.advanceTimersByTimeAsync(30000)
|
|
expect(heartbeatSpy).toHaveBeenCalledTimes(1)
|
|
|
|
await vi.advanceTimersByTimeAsync(30000)
|
|
expect(heartbeatSpy).toHaveBeenCalledTimes(2)
|
|
|
|
clearInterval(intervalId)
|
|
vi.useRealTimers()
|
|
})
|
|
|
|
it('should fire two heartbeats within 70 seconds', async () => {
|
|
vi.useFakeTimers()
|
|
|
|
const heartbeatSpy = vi.fn()
|
|
const intervalId = setInterval(() => {
|
|
heartbeatSpy()
|
|
}, HEARTBEAT_INTERVAL_MS)
|
|
|
|
await vi.advanceTimersByTimeAsync(70000)
|
|
expect(heartbeatSpy).toHaveBeenCalledTimes(2)
|
|
|
|
clearInterval(intervalId)
|
|
vi.useRealTimers()
|
|
})
|
|
})
|
|
})
|