smartproxy/test/test.smartacme-integration.ts

50 lines
1.5 KiB
TypeScript
Raw Normal View History

import * as plugins from '../ts/plugins.js';
import { tap } from '@push.rocks/tapbundle';
import { SmartCertManager } from '../ts/proxies/smart-proxy/certificate-manager.js';
import type { IRouteConfig } from '../ts/proxies/smart-proxy/models/route-types.js';
let certManager: SmartCertManager;
tap.test('should create a SmartCertManager instance', async () => {
const routes: IRouteConfig[] = [
{
name: 'test-acme-route',
match: {
domains: ['test.example.com']
},
action: {
type: 'proxy',
target: 'http://localhost:3000',
tls: {
mode: 'terminate',
certificate: 'auto'
},
acme: {
email: 'test@example.com'
}
}
}
];
certManager = new SmartCertManager(routes, './test-certs', {
email: 'test@example.com',
useProduction: false
});
// Just verify it creates without error
expect(certManager).toBeInstanceOf(SmartCertManager);
});
tap.test('should verify SmartAcme handlers are accessible', async () => {
// Test that we can access SmartAcme handlers
const http01Handler = new plugins.smartacme.handlers.Http01MemoryHandler();
expect(http01Handler).toBeDefined();
});
tap.test('should verify SmartAcme cert managers are accessible', async () => {
// Test that we can access SmartAcme cert managers
const memoryCertManager = new plugins.smartacme.certmanagers.MemoryCertManager();
expect(memoryCertManager).toBeDefined();
});
tap.start();