|
defmodule MedicodeWeb.TranscriptionsLive.ShowTest do |
|
use MedicodeWeb.ConnCase, async: true |
|
|
|
import Phoenix.LiveViewTest |
|
|
|
import Medicode.{ |
|
AccountsFixtures, |
|
TranscriptionsFixtures, |
|
TranscriptionChunksFixtures |
|
} |
|
|
|
setup %{conn: conn} do |
|
password = valid_user_password() |
|
user = user_fixture(%{password: password}) |
|
transcription = transcription_fixture(%{filename: "my-audio.mp3"}) |
|
|
|
transcription_chunk_fixture(%{transcription_id: transcription.id, text: "Foo"}) |
|
transcription_chunk_fixture(%{transcription_id: transcription.id, text: "Bar"}) |
|
|
|
%{conn: log_in_user(conn, user), current_user: user, transcription: transcription} |
|
end |
|
|
|
describe "/" do |
|
test "renders transcription show screen", %{conn: conn, transcription: transcription} do |
|
conn = get(conn, "/transcriptions/#{transcription.id}") |
|
assert html_response(conn, 200) =~ "Medical Code Transcriber" |
|
|
|
{:ok, _view, html} = live(conn) |
|
assert html =~ "my-audio.mp3" |
|
assert html =~ "Foo" |
|
assert html =~ "Bar" |
|
end |
|
|
|
test "renders 'Not Found' for 404", %{conn: conn} do |
|
invalid_id = Ecto.UUID.generate() |
|
conn = get(conn, "/transcriptions/#{invalid_id}") |
|
assert html_response(conn, 404) =~ "Transcription not found" |
|
end |
|
end |
|
end |
|
|