import { describe, expect, it, vi } from 'vitest';
vi.mock('../../ai/runtime.js', () => ({
    generateTextForFeature: vi.fn(),
}));
import { generateTextForFeature } from '../../ai/runtime.js';
import { generateContentWritingWithFallback } from '../../ai/content-writing-generate.js';
describe('generateContentWritingWithFallback', () => {
    it('returns governed text when the feature runtime succeeds', async () => {
        vi.mocked(generateTextForFeature).mockResolvedValueOnce({
            ok: true,
            text: '{"tone":"clear"}',
            usage: { promptTokens: 1, completionTokens: 1, totalTokens: 2 },
            modelId: 'openai:gpt-4o',
            providerModelId: 'gpt-4o',
        });
        const result = await generateContentWritingWithFallback({}, {
            prompt: 'Analyze',
            userId: 'u1',
        });
        expect(result).toEqual({ ok: true, text: '{"tone":"clear"}' });
    });
    it('returns a specific setup message when no model is configured', async () => {
        vi.mocked(generateTextForFeature).mockResolvedValueOnce({
            ok: false,
            code: 'no_model',
            message: 'No AI model is configured.',
        });
        const result = await generateContentWritingWithFallback({}, {
            prompt: 'Analyze',
        });
        expect(result.ok).toBe(false);
        if (!result.ok) {
            expect(result.httpStatus).toBe(503);
            expect(result.message).toContain('default model');
        }
    });
});
//# sourceMappingURL=content-writing-generate.test.js.map