File size: 877 Bytes
3f219b5
34b4725
3f219b5
34b4725
 
3f219b5
34b4725
3f219b5
89a368d
3f219b5
34b4725
89a368d
 
 
 
 
 
 
 
 
 
 
 
 
3f219b5
89a368d
 
 
 
 
 
34b4725
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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