fix(strcuture): refactor responsibilities

This commit is contained in:
2025-05-19 17:28:05 +00:00
parent 8fb67922a5
commit 465148d553
62 changed files with 1414 additions and 2066 deletions

View File

@ -1,5 +1,6 @@
import { tap, expect } from '@git.zone/tstest/tapbundle';
import { SmartProxy } from '../ts/index.js';
import * as plugins from '../ts/plugins.js';
/**
* Test that verifies ACME challenge routes are properly created
@ -22,22 +23,23 @@ tap.test('should create ACME challenge route with high ports', async (tools) =>
target: { host: 'localhost', port: 8080 },
tls: {
mode: 'terminate' as const,
certificate: 'auto'
certificate: 'auto' as const
}
}
}
],
acme: {
email: 'test@test.local',
port: 18080 // High port for ACME challenges
email: 'test@example.com',
port: 18080, // High port for ACME challenges
useProduction: false // Use staging environment
}
};
const proxy = new SmartProxy(settings);
// Capture route updates
const originalUpdateRoutes = (proxy as any).updateRoutesInternal.bind(proxy);
(proxy as any).updateRoutesInternal = async function(routes: any[]) {
const originalUpdateRoutes = (proxy as any).updateRoutes.bind(proxy);
(proxy as any).updateRoutes = async function(routes: any[]) {
capturedRoutes.push([...routes]);
return originalUpdateRoutes(routes);
};