41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
import { describe, expect, it, vi } from 'vitest';
|
|||
|
|
|
||
|
|
import { createStartupPipelineRuntime } from './startup-pipeline-runtime.js';
|
||
|
|
|
||
|
|
describe('startup pipeline runtime', () => {
|
||
|
|
it('publishes the listening port before bootstrapping managed OpenCode', async () => {
|
||
|
|
const order = [];
|
||
|
|
const runtime = createStartupPipelineRuntime({
|
||
|
|
createTerminalRuntime: () => ({}),
|
||
|
|
createDictationRuntime: () => ({}),
|
||
|
|
createMessageStreamWsRuntime: () => ({}),
|
||
|
|
createServerStartupRuntime: () => ({
|
||
|
|
resolveBindHost: () => '127.0.0.1',
|
||
|
|
startListeningAndMaybeTunnel: async () => {
|
||
|
|
order.push('listen');
|
||
|
|
return { activePort: 3901 };
|
||
|
|
},
|
||
|
|
attachProcessHandlers: vi.fn(),
|
||
|
|
}),
|
||
|
|
});
|
||
|
|
|
||
|
|
await runtime.run({
|
||
|
|
app: {},
|
||
|
|
setupProxy: vi.fn(),
|
||
|
|
staticRoutesRuntime: { registerStaticRoutes: vi.fn() },
|
||
|
|
apiOnly: false,
|
||
|
|
tunnelRuntimeContext: {
|
||
|
|
setActivePort: (port) => order.push(`port:${port}`),
|
||
|
|
},
|
||
|
|
scheduleOpenCodeApiDetection: () => order.push('detect'),
|
||
|
|
bootstrapOpenCodeAtStartup: () => order.push('bootstrap'),
|
||
|
|
process: {},
|
||
|
|
crypto: {},
|
||
|
|
server: {},
|
||
|
|
attachSignals: false,
|
||
|
|
});
|
||
|
|
|
||
|
|
expect(order).toEqual(['listen', 'port:3901', 'detect', 'bootstrap']);
|
||
|
|
});
|
||
|
|
});
|