import { describe, it, expect, vi, beforeEach } from 'vitest';
vi.mock('@aws-sdk/client-sesv2', () => {
    const sendMock = vi.fn().mockImplementation((cmd) => {
        if (cmd && cmd.__type === 'GetAccount') {
            return Promise.resolve({
                SendQuota: { MaxSendRate: 14, Max24HourSend: 50000, SentLast24Hours: 100 },
            });
        }
        return Promise.resolve({ MessageId: 'mock-msg-id-123' });
    });
    const quotaMock = vi.fn().mockResolvedValue({
        SendQuota: { MaxSendRate: 14, Max24HourSend: 50000, SentLast24Hours: 100 },
    });
    return {
        SESv2Client: vi.fn().mockImplementation(() => ({ send: sendMock })),
        SendEmailCommand: vi.fn().mockImplementation((params) => params),
        GetAccountCommand: vi.fn().mockImplementation(() => ({ __type: 'GetAccount' })),
        __sendMock: sendMock,
        __quotaMock: quotaMock,
    };
});
import { createSesClient } from '../ses-client.js';
describe('ses-client', () => {
    beforeEach(() => { vi.clearAllMocks(); });
    it('should send an email and return messageId', async () => {
        const client = createSesClient({ region: 'us-east-1', accessKeyId: 'test', secretAccessKey: 'test' });
        const result = await client.sendEmail({
            to: 'user@example.com',
            from: 'noreply@test.com',
            fromName: 'Test',
            subject: 'Hello',
            htmlBody: '<p>Hi</p>',
            textBody: 'Hi',
        });
        expect(result.messageId).toBe('mock-msg-id-123');
    });
    it('should return quota info', async () => {
        const client = createSesClient({ region: 'us-east-1', accessKeyId: 'test', secretAccessKey: 'test' });
        const quota = await client.getSendQuota();
        expect(quota.maxSendRate).toBe(14);
        expect(quota.max24HourSend).toBe(50000);
    });
    it('should return null client when no credentials', () => {
        const client = createSesClient({ region: 'us-east-1' });
        expect(client.isConfigured()).toBe(false);
    });
});
//# sourceMappingURL=ses-client.test.js.map