# This file is auto-generated by alef — DO NOT EDIT.
# alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75
# To regenerate: alef generate
# To verify freshness: alef verify --exit-code
# Issues & docs: https://github.com/kreuzberg-dev/alef
# frozen_string_literal: true

require 'kreuzberg'
require 'json'
require 'spec_helper'

RSpec.describe 'detection' do
  it 'detect_mime_bytes_html: Detect HTML MIME from bytes' do
    content = File.read("html/html.html").bytes
    result = Kreuzberg.detect_mime_type_from_bytes(content)

    expect(result).not_to be_nil
  end

  it 'detect_mime_bytes_pdf: Detect PDF MIME type from bytes' do
    content = File.read("pdf/fake_memo.pdf").bytes
    result = Kreuzberg.detect_mime_type_from_bytes(content)

    expect(result).not_to be_nil
  end

  it 'detect_mime_bytes_png: Detect PNG MIME type from bytes' do
    content = File.read("images/test_hello_world.png").bytes
    result = Kreuzberg.detect_mime_type_from_bytes(content)

    expect(result).not_to be_nil
  end

  it 'get_extensions_unknown_mime: get_extensions unknown MIME' do
    expect {
      Kreuzberg.get_extensions_for_mime('application/x-totally-unknown')
    }.to raise_error(RuntimeError)
  end
end
