"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const vitest_1 = require("vitest");
const config_js_1 = require("./config.js");
(0, vitest_1.describe)('config', () => {
    (0, vitest_1.describe)('loadConfig', () => {
        (0, vitest_1.it)('should return default values when env vars are not set', () => {
            const cfg = (0, config_js_1.loadConfig)();
            (0, vitest_1.expect)(cfg.port).toBe(3001);
            (0, vitest_1.expect)(typeof cfg.nodeEnv).toBe('string');
            (0, vitest_1.expect)(cfg.nodeEnv.length).toBeGreaterThan(0);
            (0, vitest_1.expect)(cfg.dataDir).toContain('data');
        });
    });
    (0, vitest_1.describe)('validateConfig', () => {
        (0, vitest_1.it)('should return error when encryptionKey is empty', () => {
            const cfg = {
                port: 3001,
                nodeEnv: 'development',
                openrouterApiKey: '',
                kieApiKey: '',
                geminiApiKey: '',
                encryptionKey: '',
                dataDir: '/tmp/data',
                webhookBaseUrl: '',
                telegramApiId: 0,
                telegramApiHash: '',
            };
            const errors = (0, config_js_1.validateConfig)(cfg);
            (0, vitest_1.expect)(errors).toContain('ENCRYPTION_KEY is required for secure storage');
        });
        (0, vitest_1.it)('should return error for invalid port', () => {
            const cfg = {
                port: 0,
                nodeEnv: 'development',
                openrouterApiKey: '',
                kieApiKey: '',
                geminiApiKey: '',
                encryptionKey: 'some-key',
                dataDir: '/tmp/data',
                webhookBaseUrl: '',
                telegramApiId: 0,
                telegramApiHash: '',
            };
            const errors = (0, config_js_1.validateConfig)(cfg);
            (0, vitest_1.expect)(errors).toContain('PORT must be between 1 and 65535');
        });
        (0, vitest_1.it)('should return no errors for valid config', () => {
            const cfg = {
                port: 3001,
                nodeEnv: 'development',
                openrouterApiKey: '',
                kieApiKey: '',
                geminiApiKey: '',
                encryptionKey: 'my-secret-key',
                dataDir: '/tmp/data',
                webhookBaseUrl: '',
                telegramApiId: 0,
                telegramApiHash: '',
            };
            const errors = (0, config_js_1.validateConfig)(cfg);
            (0, vitest_1.expect)(errors).toHaveLength(0);
        });
    });
});
//# sourceMappingURL=config.test.js.map