|
defmodule Medicode.TranscriptionServerTest do |
|
@moduledoc """ |
|
Tests for Medicode.TranscriptionServer |
|
""" |
|
|
|
use Medicode.DataCase |
|
|
|
import Medicode.TranscriptionsFixtures |
|
|
|
alias Medicode.Transcriptions |
|
alias Medicode.TranscriptionServer |
|
|
|
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 |
|
spec = {TranscriptionServer, {:transcription, transcription}} |
|
|
|
{:ok, pid} = start_supervised(spec, restart: :transient) |
|
|
|
|
|
|
|
|
|
ref = Process.monitor(pid) |
|
|
|
assert_receive({:DOWN, ^ref, :process, _object, _pid}, 5_000) |
|
|
|
transcription = Transcriptions.get_transcription!(transcription.id, true) |
|
assert 14 == Enum.count(transcription.chunks) |
|
end |
|
end |
|
|