import { describe, it, expect } from 'vitest';
import { sanitizeScreenshotBase64 } from './screenshotDownload';

describe('screenshotDownload', () => {
  it('sanitizeScreenshotBase64 picks the longest base64 chunk', () => {
    const junk = "warning\n/9j/QUJD\n";
    const b64 = 'A'.repeat(120);
    expect(sanitizeScreenshotBase64(`${junk}${b64}`)).toBe(b64);
  });

  it('returns empty when no valid base64', () => {
    expect(sanitizeScreenshotBase64('not an image')).toBe('');
  });
});
