mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-12 20:15:40 +00:00
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:
1 parent
2c817fae48
commit
31dc18657c
3 files changed
+3
-3
No files matched your search
@@ -33,7 +33,7 @@ const configCache: Map<CLIProxyProvider, BaseSettings> = new Map();
|
|||||||
function getBaseConfigPath(provider: CLIProxyProvider): string {
|
function getBaseConfigPath(provider: CLIProxyProvider): string {
|
||||||
// __dirname points to dist/cliproxy at runtime
|
// __dirname points to dist/cliproxy at runtime
|
||||||
// Config files are at package root: ../config/
|
// 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`);
|
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
|
// Mutable holder so each test can override the resolved value
|
||||||
let mockStatus: ProxyStatus = { running: false, verified: false };
|
let mockStatus: ProxyStatus = { running: false, verified: false };
|
||||||
|
|
||||||
mock.module('../../../src/cliproxy/proxy-detector', () => ({
|
mock.module('../../../src/cliproxy/proxy/proxy-detector', () => ({
|
||||||
detectRunningProxy: async () => mockStatus,
|
detectRunningProxy: async () => mockStatus,
|
||||||
waitForProxyHealthy: async () => false,
|
waitForProxyHealthy: async () => false,
|
||||||
reclaimOrphanedProxy: () => null,
|
reclaimOrphanedProxy: () => null,
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ describe('cliproxy routing routes', () => {
|
|||||||
applied: 'config-only',
|
applied: 'config-only',
|
||||||
}));
|
}));
|
||||||
|
|
||||||
mock.module('../../../src/cliproxy/routing-strategy', () => ({
|
mock.module('../../../src/cliproxy/routing/routing-strategy', () => ({
|
||||||
readCliproxyRoutingState: readStateMock,
|
readCliproxyRoutingState: readStateMock,
|
||||||
applyCliproxyRoutingStrategy: applyStrategyMock,
|
applyCliproxyRoutingStrategy: applyStrategyMock,
|
||||||
readCliproxySessionAffinityState: readAffinityStateMock,
|
readCliproxySessionAffinityState: readAffinityStateMock,
|
||||||
|
|||||||
Reference in new issue
Block a user