fix(cliproxy): fix base-config-loader __dirname path and stale mock.module paths

- base-config-loader.ts moved from src/cliproxy/ to src/cliproxy/config/,
  so __dirname relative path needs one more .. to reach config/ dir
- Update mock.module paths for proxy-detector and routing-strategy
  in non-colocated test files
This commit is contained in:
Tam Nhu Tran
2026-04-29 17:40:33 -04:00
parent 2c817fae48
commit 31dc18657c
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ const configCache: Map<CLIProxyProvider, BaseSettings> = new Map();
function getBaseConfigPath(provider: CLIProxyProvider): string {
// __dirname points to dist/cliproxy at runtime
// Config files are at package root: ../config/
const configDir = path.join(__dirname, '..', '..', 'config');
const configDir = path.join(__dirname, '..', '..', '..', 'config');
return path.join(configDir, `base-${provider}.settings.json`);
}
@@ -11,7 +11,7 @@ import type { ProxyStatus } from '../../../src/cliproxy/proxy/proxy-detector';
// Mutable holder so each test can override the resolved value
let mockStatus: ProxyStatus = { running: false, verified: false };
mock.module('../../../src/cliproxy/proxy-detector', () => ({
mock.module('../../../src/cliproxy/proxy/proxy-detector', () => ({
detectRunningProxy: async () => mockStatus,
waitForProxyHealthy: async () => false,
reclaimOrphanedProxy: () => null,
@@ -42,7 +42,7 @@ describe('cliproxy routing routes', () => {
applied: 'config-only',
}));
mock.module('../../../src/cliproxy/routing-strategy', () => ({
mock.module('../../../src/cliproxy/routing/routing-strategy', () => ({
readCliproxyRoutingState: readStateMock,
applyCliproxyRoutingStrategy: applyStrategyMock,
readCliproxySessionAffinityState: readAffinityStateMock,