Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

781 B
Raw Blame
import { describe, expect, it, vi } from 'vitest';

const fetchPublicBinary = vi.fn();
vi.mock('../lib/safeUrlFetch.js', () => ({ fetchPublicBinary }));
const { fetchAndNormalizeStackerNewsImage } = await import('./stackerNewsMedia.js');

describe('Stacker News remote media', () => {
  it('uses the strict public fetch posture and rejects active formats before decoding', async () => {
    fetchPublicBinary.mockResolvedValue({ buffer: Buffer.from('<svg/>'), contentType: 'image/svg+xml' });
    await expect(fetchAndNormalizeStackerNewsImage('https://example.com/image.svg')).rejects.toThrow('Unsupported');
    expect(fetchPublicBinary).toHaveBeenCalledWith('https://example.com/image.svg', expect.objectContaining({ blockPrivate: true, maxBytes: 5 * 1024 * 1024 }));
  });
});