import { tap, expect } from '@push.rocks/tapbundle'; import { SmartAcme, MemoryCertManager } from '../ts/index.js'; import type { IChallengeHandler } from '../ts/handlers/IChallengeHandler.js'; // Dummy handler for testing class DummyHandler implements IChallengeHandler { getSupportedTypes(): string[] { return ['dns-01']; } async prepare(_: any): Promise { /* no-op */ } async cleanup(_: any): Promise { /* no-op */ } } tap.test('constructor throws without challengeHandlers', async () => { expect(() => new SmartAcme({ accountEmail: 'test@example.com', certManager: new MemoryCertManager(), environment: 'integration', retryOptions: {}, } as any)).toThrow(); }); tap.test('constructor accepts valid challengeHandlers', async () => { const sa = new SmartAcme({ accountEmail: 'test@example.com', certManager: new MemoryCertManager(), environment: 'integration', retryOptions: {}, challengeHandlers: [new DummyHandler()], }); expect(sa).toBeInstanceOf(SmartAcme); }); export default tap.start();