<commit_before>defmodule Appsignal.WrappedNif do
  alias Appsignal.Nif

  def start_link do
    {:ok, pid} = Agent.start_link(fn -> %{create_root_span: []} end, name: __MODULE__)
  end<commit_msg>Await WrappedNif's DOWN in an ExUnit callback<commit_after>defmodule Appsignal.WrappedNif do
  import ExUnit.Assertions
  alias Appsignal.Nif

  def start_link do
    {:ok, pid} =
      Agent.start_link(fn -> %{create_root_span: [], close_span: []} end, name: __MODULE__)

    ExUnit.Callbacks.on_exit(fn ->
      ref = Process.monitor(pid)
      assert_receive {:DOWN, ^ref, _, _, _}, 500
    end)

    {:ok, pid}
  end
{'fraction_non_alphanumeric': 0.12175324675324675, 'fraction_numerical': 0.00487012987012987, 'mean_word_length': 3.7099236641221376, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4923255', 'n_tokens_mistral': 231, 'n_tokens_neox': 217, 'n_words': 50}