mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 00:27:39 +00:00
Bundle a pinned, verified Bun runtime for headless Orca so existing Node launch commands can hand off before opening a profile. Keep desktop execution on Electron. Add the Bun SQLite adapter and terminal backend, bounded shutdown, process inspection and cross-platform artifact qualification. Keep future managed SSH deployment separate from current production launch paths.
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import { beforeEach, expect, it, vi } from 'vitest'
|
|
import { loadParcelWatcher } from './parcel-watcher-module-loader'
|
|
|
|
const state = vi.hoisted((): { named: unknown; fallback: unknown } => ({
|
|
named: undefined,
|
|
fallback: undefined
|
|
}))
|
|
vi.mock('@parcel/watcher', () => ({
|
|
get subscribe() {
|
|
return state.named
|
|
},
|
|
get default() {
|
|
return state.fallback
|
|
}
|
|
}))
|
|
beforeEach(() => {
|
|
state.named = undefined
|
|
state.fallback = undefined
|
|
})
|
|
|
|
it('uses named exports when the runtime exposes them', async () => {
|
|
const subscribe = vi.fn()
|
|
state.named = subscribe
|
|
state.fallback = { subscribe: vi.fn() }
|
|
expect((await loadParcelWatcher()).subscribe).toBe(subscribe)
|
|
})
|
|
|
|
it('loads the full CommonJS default when a packaged wrapper has no named exports', async () => {
|
|
const subscribe = vi.fn()
|
|
const getEventsSince = vi.fn()
|
|
state.fallback = { subscribe, getEventsSince }
|
|
expect(await loadParcelWatcher()).toBe(state.fallback)
|
|
expect((await loadParcelWatcher()).getEventsSince).toBe(getEventsSince)
|
|
})
|
|
|
|
it.each([undefined, null, {}, { subscribe: false }])(
|
|
'rejects invalid watcher exports (%j)',
|
|
async (fallback) => {
|
|
state.fallback = fallback
|
|
await expect(loadParcelWatcher()).rejects.toThrow('parcel_watcher_module_invalid')
|
|
}
|
|
)
|