import {
  isBlobObjectUrl,
  isFileProtocolObjectUrl,
  needsBlobObjectUrlForInlineDisplay
} from './attachment-display-url.rules';

describe('attachment display url rules', () => {
  it('detects blob and file protocol urls', () => {
    expect(isBlobObjectUrl('blob:http://localhost/abc')).toBe(true);
    expect(isBlobObjectUrl('file:///tmp/video.mp4')).toBe(false);
    expect(isFileProtocolObjectUrl('file:///tmp/video.mp4')).toBe(true);
    expect(isFileProtocolObjectUrl('blob:http://localhost/abc')).toBe(false);
  });

  it('requires blob urls for inline display when missing or file protocol', () => {
    expect(needsBlobObjectUrlForInlineDisplay(undefined)).toBe(true);
    expect(needsBlobObjectUrlForInlineDisplay('file:///appdata/image.png')).toBe(true);
    expect(needsBlobObjectUrlForInlineDisplay('blob:http://localhost/abc')).toBe(false);
  });
});
