File size: 825 Bytes
bdb4b8b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
defmodule Medicode.SidebarComponentTest do
  use MedicodeWeb.ConnCase, async: true

  import Phoenix.LiveViewTest

  import Medicode.{
    AccountsFixtures,
    TranscriptionsFixtures
  }

  alias MedicodeWeb.Components.SidebarComponent

  describe "SidebarComponent" do
    setup do
      user = user_fixture()

      transcription_fixture(%{user: user, filename: "Transcript #1"})
      transcription_fixture(%{user: user, filename: "Transcript #2"})
      transcription_fixture(%{filename: "Transcript #3"})

      %{user: user}
    end

    test "renders a list of transcriptions for current user", %{user: user} do
      html = render_component(SidebarComponent, id: 1, current_user: user)

      assert html =~ "Transcript #1"
      assert html =~ "Transcript #2"
      refute html =~ "Transcript #3"
    end
  end
end