mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-15 20:20:09 +00:00
Resolve the dispatcher and dashboard conflicts from origin/dev while preserving the configured local CLIProxy port behavior. Also harden lifecycle port fallback and wait for the actual stopped port during binary installs.
41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
import { describe, expect, it } from 'bun:test';
|
|
import { CLIPROXY_DEFAULT_PORT, resolveLifecyclePort } from '../../../src/cliproxy/config/port-manager';
|
|
|
|
describe('resolveLifecyclePort', () => {
|
|
it('uses configured cliproxy_server.local.port', () => {
|
|
expect(
|
|
resolveLifecyclePort({
|
|
cliproxy_server: {
|
|
local: {
|
|
port: 9456,
|
|
},
|
|
},
|
|
})
|
|
).toBe(9456);
|
|
});
|
|
|
|
it('falls back to default port when configured local port is invalid', () => {
|
|
expect(
|
|
resolveLifecyclePort({
|
|
cliproxy_server: {
|
|
local: {
|
|
port: 70000,
|
|
},
|
|
},
|
|
})
|
|
).toBe(CLIPROXY_DEFAULT_PORT);
|
|
});
|
|
|
|
it('falls back to default port when config file is missing', () => {
|
|
expect(resolveLifecyclePort({})).toBe(CLIPROXY_DEFAULT_PORT);
|
|
});
|
|
|
|
it('falls back to default port when loading unified config throws', () => {
|
|
expect(
|
|
resolveLifecyclePort(undefined, () => {
|
|
throw new Error('malformed config');
|
|
})
|
|
).toBe(CLIPROXY_DEFAULT_PORT);
|
|
});
|
|
});
|