Files
smartproxy/test/test.route-security-unit.ts

39 lines
1.0 KiB
TypeScript
Raw Permalink Normal View History

2025-05-29 12:15:53 +00:00
import { tap, expect } from '@git.zone/tstest/tapbundle';
import * as smartproxy from '../ts/index.js';
tap.test('route security should be correctly configured', async () => {
// Test that we can create a proxy with route-specific security
const routes = [{
name: 'secure-route',
match: {
ports: 8990
},
action: {
type: 'forward' as const,
targets: [{
2025-05-29 12:15:53 +00:00
host: '127.0.0.1',
port: 8991
}]
},
security: {
ipAllowList: ['192.168.1.1'],
ipBlockList: ['10.0.0.1']
2025-05-29 12:15:53 +00:00
}
}];
2025-05-29 12:15:53 +00:00
// This should not throw an error
const proxy = new smartproxy.SmartProxy({
enableDetailedLogging: false,
routes: routes
});
2025-05-29 12:15:53 +00:00
// The proxy should be created successfully
expect(proxy).toBeInstanceOf(smartproxy.SmartProxy);
// Verify route configuration was preserved
expect(proxy.settings.routes[0].security?.ipAllowList).toContain('192.168.1.1');
expect(proxy.settings.routes[0].security?.ipBlockList).toContain('10.0.0.1');
2025-05-29 12:15:53 +00:00
});
export default tap.start();