fix(strcuture): refactor responsibilities
This commit is contained in:
@ -21,7 +21,7 @@ tap.test('should not double-register port 80 when user route and ACME use same p
|
||||
},
|
||||
action: {
|
||||
type: 'forward' as const,
|
||||
targetUrl: 'http://localhost:3000'
|
||||
target: { host: 'localhost', port: 3000 }
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -31,10 +31,10 @@ tap.test('should not double-register port 80 when user route and ACME use same p
|
||||
},
|
||||
action: {
|
||||
type: 'forward' as const,
|
||||
targetUrl: 'https://localhost:3001',
|
||||
target: { host: 'localhost', port: 3001 },
|
||||
tls: {
|
||||
mode: 'terminate' as const,
|
||||
certificate: 'auto'
|
||||
certificate: 'auto' as const
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -80,7 +80,7 @@ tap.test('should not double-register port 80 when user route and ACME use same p
|
||||
(proxy as any).createCertificateManager = async function(routes: any[], certDir: string, acmeOptions: any, initialState?: any) {
|
||||
const mockCertManager = {
|
||||
setUpdateRoutesCallback: function(callback: any) { /* noop */ },
|
||||
setNetworkProxy: function() {},
|
||||
setHttpProxy: function() {},
|
||||
setGlobalAcmeDefaults: function() {},
|
||||
setAcmeStateManager: function() {},
|
||||
initialize: async function() {
|
||||
@ -122,7 +122,7 @@ tap.test('should not double-register port 80 when user route and ACME use same p
|
||||
await proxy.start();
|
||||
|
||||
// Verify that port 80 was added only once
|
||||
tools.expect(port80AddCount).toEqual(1);
|
||||
expect(port80AddCount).toEqual(1);
|
||||
|
||||
await proxy.stop();
|
||||
});
|
||||
@ -146,7 +146,7 @@ tap.test('should handle ACME on different port than user routes', async (tools)
|
||||
},
|
||||
action: {
|
||||
type: 'forward' as const,
|
||||
targetUrl: 'http://localhost:3000'
|
||||
target: { host: 'localhost', port: 3000 }
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -156,10 +156,10 @@ tap.test('should handle ACME on different port than user routes', async (tools)
|
||||
},
|
||||
action: {
|
||||
type: 'forward' as const,
|
||||
targetUrl: 'https://localhost:3001',
|
||||
target: { host: 'localhost', port: 3001 },
|
||||
tls: {
|
||||
mode: 'terminate' as const,
|
||||
certificate: 'auto'
|
||||
certificate: 'auto' as const
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -202,7 +202,7 @@ tap.test('should handle ACME on different port than user routes', async (tools)
|
||||
(proxy as any).createCertificateManager = async function(routes: any[], certDir: string, acmeOptions: any, initialState?: any) {
|
||||
const mockCertManager = {
|
||||
setUpdateRoutesCallback: function(callback: any) { /* noop */ },
|
||||
setNetworkProxy: function() {},
|
||||
setHttpProxy: function() {},
|
||||
setGlobalAcmeDefaults: function() {},
|
||||
setAcmeStateManager: function() {},
|
||||
initialize: async function() {
|
||||
@ -243,11 +243,11 @@ tap.test('should handle ACME on different port than user routes', async (tools)
|
||||
await proxy.start();
|
||||
|
||||
// Verify that all expected ports were added
|
||||
tools.expect(portAddHistory).toContain(80); // User route
|
||||
tools.expect(portAddHistory).toContain(443); // TLS route
|
||||
tools.expect(portAddHistory).toContain(8080); // ACME challenge on different port
|
||||
expect(portAddHistory.includes(80)).toBeTrue(); // User route
|
||||
expect(portAddHistory.includes(443)).toBeTrue(); // TLS route
|
||||
expect(portAddHistory.includes(8080)).toBeTrue(); // ACME challenge on different port
|
||||
|
||||
await proxy.stop();
|
||||
});
|
||||
|
||||
export default tap;
|
||||
export default tap.start();
|
Reference in New Issue
Block a user