# 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
# E2e tests for category: async
defmodule E2e.AsyncTest do
  use ExUnit.Case, async: false

  describe "async_extract_bytes" do
    test "async_extract_bytes" do
      content = File.read!("../../test_documents/pdf/fake_memo.pdf")
      {:ok, result} = Kreuzberg.extract_bytes_async(content, "application/pdf")
      assert String.trim(result.mime_type) == "application/pdf"
      assert (is_binary(result.content) && byte_size(result.content) >= 50) || (is_list(result.content) && length(result.content) >= 50) || (is_binary(result.content) == false && is_list(result.content) == false && String.length(result.content) >= 50)
    end
  end

  describe "async_extract_bytes_empty_mime" do
    test "async_extract_bytes_empty_mime" do
      content = File.read!("../../test_documents/text/plain.txt")
      assert {:error, _} = Kreuzberg.extract_bytes_async(content, "", "{}")
    end
  end

  describe "async_extract_bytes_invalid_mime" do
    test "async_extract_bytes_invalid_mime" do
      content = File.read!("../../test_documents/text/plain.txt")
      assert {:error, _} = Kreuzberg.extract_bytes_async(content, "application/x-nonexistent", "{}")
    end
  end
end
