defmodule Medicode.TranscriptionSupervisorTest do | |
@moduledoc """ | |
Tests for Medicode.TranscriptionServer | |
""" | |
use Medicode.DataCase | |
import Medicode.TranscriptionsFixtures | |
alias Medicode.TranscriptionSupervisor | |
setup do | |
sample_file = | |
__DIR__ | |
|> Path.join("../../medasrdemo-Paul.mp3") | |
|> Path.expand() | |
transcription = transcription_fixture(%{filename: sample_file}) | |
%{transcription: transcription} | |
end | |
test "transcribe and tag audio", %{transcription: transcription} do | |
assert {:ok, _pid} = TranscriptionSupervisor.start_transcription(transcription) | |
{_, server_pid, :worker, [Medicode.TranscriptionServer]} = | |
TranscriptionSupervisor | |
|> DynamicSupervisor.which_children() | |
|> Enum.at(0) | |
ref = Process.monitor(server_pid) | |
assert_receive({:DOWN, ^ref, :process, _object, _pid}, 5_000) | |
end | |
end | |