import { describe, it, expect } from 'vitest';
import { detectLanguage, detectEnhancements } from '../utils';

describe('detectLanguage', () => {
  it('should detect English', () => {
    expect(detectLanguage('a sunset over the ocean')).toBe('English');
  });

  it('should detect Chinese', () => {
    expect(detectLanguage('美丽的日落')).toBe('Chinese');
  });

  it('should detect Japanese', () => {
    expect(detectLanguage('こんにちは')).toBe('Japanese');
  });

  it('should detect Korean', () => {
    expect(detectLanguage('아름다운 일몰')).toBe('Korean');
  });

  it('should detect Romance Language', () => {
    expect(detectLanguage('hermosa puesta de sól')).toBe('Romance Language');
    expect(detectLanguage('beau coucher de soléil')).toBe('Romance Language');
  });

  it('should detect Russian', () => {
    expect(detectLanguage('красивый закат')).toBe('Russian');
  });

  it('should detect Greek', () => {
    expect(detectLanguage('όμορφο ηλιοβασίλεμα')).toBe('Greek');
  });

  it('should detect Arabic', () => {
    expect(detectLanguage('غروب جميل')).toBe('Arabic');
  });

  it('should detect Hebrew', () => {
    expect(detectLanguage('שקיעה יפה')).toBe('Hebrew');
  });

  it('should default to English for unknown scripts', () => {
    expect(detectLanguage('123')).toBe('English');
  });
});

describe('detectEnhancements', () => {
  it('should detect added detailed descriptions', () => {
    const original = 'sunset';
    const enhanced = 'A breathtaking sunset over the ocean with vibrant orange and pink hues';
    const enhancements = detectEnhancements(original, enhanced);
    expect(enhancements).toContain('Added detailed descriptions');
  });

  it('should detect photography terminology', () => {
    const original = 'sunset';
    const enhanced = 'A photorealistic sunset shot with 50mm lens';
    const enhancements = detectEnhancements(original, enhanced);
    expect(enhancements).toContain('Applied photography terminology');
  });

  it('should detect lighting descriptions', () => {
    const original = 'room';
    const enhanced = 'A room with soft lighting and warm illuminated corners';
    const enhancements = detectEnhancements(original, enhanced);
    expect(enhancements).toContain('Enhanced lighting description');
  });

  it('should detect texture details', () => {
    const original = 'wall';
    const enhanced = 'A wall with rough texture and weathered surface';
    const enhancements = detectEnhancements(original, enhanced);
    expect(enhancements).toContain('Added texture details');
  });

  it('should detect multiple enhancements', () => {
    const original = 'sunset';
    const enhanced =
      'A photorealistic sunset with dramatic lighting, beautiful texture in the clouds, and soft illuminated sky';
    const enhancements = detectEnhancements(original, enhanced);
    expect(enhancements.length).toBeGreaterThan(1);
  });

  it('should return empty array when no enhancements detected', () => {
    const original = 'sunset';
    const enhanced = 'sunset';
    const enhancements = detectEnhancements(original, enhanced);
    expect(enhancements).toEqual([]);
  });
});
