defmodule Medicode.ClassificationSupervisorTest do | |
@moduledoc """ | |
Tests for Medicode.ClassificationSupervisor | |
""" | |
use Medicode.DataCase | |
import Medicode.TranscriptionChunksFixtures | |
alias Medicode.ClassificationSupervisor | |
setup do | |
chunk = transcription_chunk_fixture(%{text: "patient fell and is experiecing knee pain"}) | |
%{chunk: chunk} | |
end | |
test "extract keywords and assign codes", %{chunk: chunk} do | |
assert {:ok, _pid} = ClassificationSupervisor.start_classification(chunk) | |
{_, server_pid, :worker, [Medicode.ClassificationServer]} = | |
ClassificationSupervisor | |
|> DynamicSupervisor.which_children() | |
|> Enum.at(0) | |
ref = Process.monitor(server_pid) | |
assert_receive({:DOWN, ^ref, :process, _object, _pid}, 5_000) | |
end | |
end | |