"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const vitest_1 = require("vitest");
const prompt_safety_js_1 = require("./prompt-safety.js");
(0, vitest_1.describe)('prompt-safety', () => {
    (0, vitest_1.describe)('sanitizePrompt', () => {
        (0, vitest_1.it)('should return unmodified prompt when it is already safe', () => {
            const safe = 'young woman wearing sports bra and leggings at the gym, natural lighting';
            const result = (0, prompt_safety_js_1.sanitizePrompt)(safe);
            (0, vitest_1.expect)(result.wasModified).toBe(false);
            (0, vitest_1.expect)(result.sanitizedPrompt).toBe(safe);
            (0, vitest_1.expect)(result.originalPrompt).toBe(safe);
            (0, vitest_1.expect)(result.changes).toHaveLength(0);
        });
        (0, vitest_1.it)('should replace banned words with safe alternatives', () => {
            const unsafe = 'woman wearing string bikini on the beach';
            const result = (0, prompt_safety_js_1.sanitizePrompt)(unsafe);
            (0, vitest_1.expect)(result.wasModified).toBe(true);
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('fitted swimwear');
            (0, vitest_1.expect)(result.sanitizedPrompt).not.toContain('string bikini');
            (0, vitest_1.expect)(result.changes.length).toBeGreaterThan(0);
        });
        (0, vitest_1.it)('should replace thong with fitted bottoms', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('model wearing a thong on stage');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('fitted bottoms');
            (0, vitest_1.expect)(result.wasModified).toBe(true);
        });
        (0, vitest_1.it)('should replace g-string with fitted bottoms', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('wearing a g-string');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('fitted bottoms');
        });
        (0, vitest_1.it)('should replace fishnet with patterned', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('woman in fishnet stockings');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('patterned');
            (0, vitest_1.expect)(result.sanitizedPrompt).not.toContain('fishnet');
        });
        (0, vitest_1.it)('should replace see-through with form-fitting', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('wearing a see-through blouse');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('form-fitting');
        });
        (0, vitest_1.it)('should replace transparent with lightweight', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('transparent fabric flowing in the wind');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('lightweight');
        });
        (0, vitest_1.it)('should replace sheer with delicate', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('sheer curtain dress');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('delicate');
        });
        (0, vitest_1.it)('should replace mesh with textured', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('mesh top at the club');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('textured');
        });
        (0, vitest_1.it)('should replace underwear with loungewear', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('posing in underwear');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('loungewear');
        });
        (0, vitest_1.it)('should replace panties with shorts', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('wearing panties and a tank top');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('shorts');
        });
        (0, vitest_1.it)('should allow lingerie in general descriptions (not banned)', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('woman in lingerie on the bed');
            // lingerie genel tanımda çalışıyor, artık banned değil
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('lingerie');
            (0, vitest_1.expect)(result.wasModified).toBe(false);
        });
        (0, vitest_1.it)('should replace nude with neutral-toned', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('nude colored dress');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('neutral-toned');
        });
        (0, vitest_1.it)('should replace naked with minimal clothing', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('almost naked look');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('minimal clothing');
        });
        (0, vitest_1.it)('should replace topless with backless top', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('topless model on the beach');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('backless top');
        });
        (0, vitest_1.it)('should replace barely covering with form-fitting', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('barely covering outfit');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('form-fitting');
        });
        (0, vitest_1.it)('should replace riding up with fitted', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('skirt riding up');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('fitted');
        });
        (0, vitest_1.it)('should replace pulled down with low-rise', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('jeans pulled down');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('low-rise');
        });
        (0, vitest_1.it)('should replace visible cleavage with flattering neckline', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('dress showing visible cleavage');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('flattering neckline');
        });
        (0, vitest_1.it)('should replace deep plunge with low neckline', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('deep plunge neckline gown');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('low neckline');
        });
        (0, vitest_1.it)('should replace bare legs/thighs/etc with toned X', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('showing bare legs and bare thighs');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('toned legs');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('toned thighs');
        });
        (0, vitest_1.it)('should replace clinging wet with damp', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('clinging wet t-shirt');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('damp');
        });
        (0, vitest_1.it)('should replace satin bra with satin halter top', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('wearing a satin bra');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('satin halter top');
        });
        (0, vitest_1.it)('should replace bra top with halter top', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('woman in a bra top');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('halter top');
        });
        (0, vitest_1.it)('should replace slip dress with mini dress', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('silk slip dress at evening party');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('mini dress');
        });
        (0, vitest_1.it)('should handle multiple banned words in a single prompt', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('woman wearing thong and fishnet stockings with see-through blouse');
            (0, vitest_1.expect)(result.wasModified).toBe(true);
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('fitted bottoms');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('patterned');
            (0, vitest_1.expect)(result.sanitizedPrompt).toContain('form-fitting');
            (0, vitest_1.expect)(result.changes.length).toBe(3);
        });
        (0, vitest_1.it)('should be case-insensitive', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('wearing FISHNET stockings and THONG');
            (0, vitest_1.expect)(result.wasModified).toBe(true);
            (0, vitest_1.expect)(result.sanitizedPrompt).not.toMatch(/fishnet/i);
            (0, vitest_1.expect)(result.sanitizedPrompt).not.toMatch(/thong/i);
        });
        (0, vitest_1.it)('should detect wet+white+shirt dangerous combo', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('woman in wet white shirt at the pool');
            (0, vitest_1.expect)(result.warnings.length).toBeGreaterThan(0);
            (0, vitest_1.expect)(result.warnings[0]).toContain('see-through');
        });
        (0, vitest_1.it)('should detect lace+bedroom dangerous combo', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('lace dress in the bedroom near the bed');
            (0, vitest_1.expect)(result.warnings.length).toBeGreaterThan(0);
            (0, vitest_1.expect)(result.warnings[0]).toContain('lingerie');
        });
        (0, vitest_1.it)('should not warn for combos when only partial match', () => {
            const result = (0, prompt_safety_js_1.sanitizePrompt)('woman in lace dress at the park');
            (0, vitest_1.expect)(result.warnings).toHaveLength(0);
        });
        (0, vitest_1.it)('should preserve the original prompt in result', () => {
            const original = 'model in fishnet stockings on the bed';
            const result = (0, prompt_safety_js_1.sanitizePrompt)(original);
            (0, vitest_1.expect)(result.originalPrompt).toBe(original);
            (0, vitest_1.expect)(result.sanitizedPrompt).not.toBe(original);
        });
    });
    (0, vitest_1.describe)('checkPromptSafety', () => {
        (0, vitest_1.it)('should return safe=true for clean prompts', () => {
            const result = (0, prompt_safety_js_1.checkPromptSafety)('woman wearing sports bra and leggings, gym workout');
            (0, vitest_1.expect)(result.safe).toBe(true);
            (0, vitest_1.expect)(result.issues).toHaveLength(0);
        });
        (0, vitest_1.it)('should return safe=false for prompts with banned words', () => {
            const result = (0, prompt_safety_js_1.checkPromptSafety)('woman in thong and fishnet stockings');
            (0, vitest_1.expect)(result.safe).toBe(false);
            (0, vitest_1.expect)(result.issues.length).toBeGreaterThan(0);
        });
        (0, vitest_1.it)('should detect dangerous combos in safety check', () => {
            const result = (0, prompt_safety_js_1.checkPromptSafety)('wet white shirt at the pool');
            (0, vitest_1.expect)(result.safe).toBe(false);
            (0, vitest_1.expect)(result.issues.length).toBeGreaterThan(0);
        });
        (0, vitest_1.it)('should list all issues found', () => {
            const result = (0, prompt_safety_js_1.checkPromptSafety)('thong and fishnet with see-through top');
            (0, vitest_1.expect)(result.safe).toBe(false);
            (0, vitest_1.expect)(result.issues.length).toBe(3);
        });
    });
    (0, vitest_1.describe)('SAFE_OUTFIT_OPTIONS', () => {
        (0, vitest_1.it)('should have all outfit categories', () => {
            (0, vitest_1.expect)(prompt_safety_js_1.SAFE_OUTFIT_OPTIONS.sexy_casual).toBeDefined();
            (0, vitest_1.expect)(prompt_safety_js_1.SAFE_OUTFIT_OPTIONS.nightlife).toBeDefined();
            (0, vitest_1.expect)(prompt_safety_js_1.SAFE_OUTFIT_OPTIONS.swimwear).toBeDefined();
            (0, vitest_1.expect)(prompt_safety_js_1.SAFE_OUTFIT_OPTIONS.intimate_morning).toBeDefined();
            (0, vitest_1.expect)(prompt_safety_js_1.SAFE_OUTFIT_OPTIONS.fashion_editorial).toBeDefined();
        });
        (0, vitest_1.it)('should have at least 5 options per category', () => {
            for (const [category, options] of Object.entries(prompt_safety_js_1.SAFE_OUTFIT_OPTIONS)) {
                (0, vitest_1.expect)(options.length, `${category} should have >= 5 options`).toBeGreaterThanOrEqual(5);
            }
        });
        (0, vitest_1.it)('should produce safe results after sanitization', () => {
            for (const [category, options] of Object.entries(prompt_safety_js_1.SAFE_OUTFIT_OPTIONS)) {
                for (const option of options) {
                    // Some options like "sheer blouse" are intentionally included
                    // but get auto-sanitized before image generation
                    const sanitized = (0, prompt_safety_js_1.sanitizePrompt)(option);
                    const postCheck = (0, prompt_safety_js_1.checkPromptSafety)(sanitized.sanitizedPrompt);
                    (0, vitest_1.expect)(postCheck.safe, `"${option}" in ${category} should be safe after sanitization but has: ${postCheck.issues.join(', ')}`).toBe(true);
                }
            }
        });
    });
});
//# sourceMappingURL=prompt-safety.test.js.map