medicode / test /medical_transcription /classification_supervisor_test.exs
timgremore's picture
chore: Rename app to Medicode
3f219b5
raw
history blame
784 Bytes
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