Commit ·
bdb4b8b
1
Parent(s): cca0704
feat: SidebarComponentTest
Browse files
test/medicode_web/components/sidebar_component_test.exs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
defmodule Medicode.SidebarComponentTest do
|
| 2 |
+
use MedicodeWeb.ConnCase, async: true
|
| 3 |
+
|
| 4 |
+
import Phoenix.LiveViewTest
|
| 5 |
+
|
| 6 |
+
import Medicode.{
|
| 7 |
+
AccountsFixtures,
|
| 8 |
+
TranscriptionsFixtures
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
alias MedicodeWeb.Components.SidebarComponent
|
| 12 |
+
|
| 13 |
+
describe "SidebarComponent" do
|
| 14 |
+
setup do
|
| 15 |
+
user = user_fixture()
|
| 16 |
+
|
| 17 |
+
transcription_fixture(%{user: user, filename: "Transcript #1"})
|
| 18 |
+
transcription_fixture(%{user: user, filename: "Transcript #2"})
|
| 19 |
+
transcription_fixture(%{filename: "Transcript #3"})
|
| 20 |
+
|
| 21 |
+
%{user: user}
|
| 22 |
+
end
|
| 23 |
+
|
| 24 |
+
test "renders a list of transcriptions for current user", %{user: user} do
|
| 25 |
+
html = render_component(SidebarComponent, id: 1, current_user: user)
|
| 26 |
+
|
| 27 |
+
assert html =~ "Transcript #1"
|
| 28 |
+
assert html =~ "Transcript #2"
|
| 29 |
+
refute html =~ "Transcript #3"
|
| 30 |
+
end
|
| 31 |
+
end
|
| 32 |
+
end
|