54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
import * as plugins from '../ts/plugins.js';
|
|
import { tap, expect } from '@git.zone/tstest/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'],
|
|
ports: []
|
|
},
|
|
action: {
|
|
type: 'forward',
|
|
target: {
|
|
host: 'localhost',
|
|
port: 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(); |