Skip to content

Commit 31c5c10

Browse files
committed
Use pattern matching to extract process id from view
1 parent a4b8afe commit 31c5c10

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

server/test/field_hub_web/live/project_show_live_test.exs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,9 @@ defmodule FieldHubWeb.ProjectShowLiveTest do
136136
end
137137

138138
test "authorized user can see monitoring page", %{conn: conn} do
139-
{:ok, view, html_on_mount} = live(conn, "/ui/projects/show/#{@project}")
139+
{:ok, %{pid: pid} = view, html_on_mount} = live(conn, "/ui/projects/show/#{@project}")
140140

141-
pid = view.pid
142-
:erlang.trace(view.pid, true, [:receive])
141+
:erlang.trace(pid, true, [:receive])
143142

144143
assert html_on_mount =~ "<h1>Project <i>#{@project}</i></h1>"
145144
assert html_on_mount =~ "No supervisor found in project document."
@@ -163,9 +162,7 @@ defmodule FieldHubWeb.ProjectShowLiveTest do
163162
end
164163

165164
test "user can trigger issue evaluation", %{conn: conn} do
166-
{:ok, view, _html_on_mount} = live(conn, "/ui/projects/show/#{@project}")
167-
168-
pid = view.pid
165+
{:ok, %{pid: pid} = view, _html_on_mount} = live(conn, "/ui/projects/show/#{@project}")
169166

170167
:erlang.trace(pid, true, [:receive])
171168

@@ -416,12 +413,12 @@ defmodule FieldHubWeb.ProjectShowLiveTest do
416413
end
417414

418415
test "file index cache can be deleted through the interface", %{conn: conn} do
419-
{:ok, view, _html_on_mount} = live(conn, "/ui/projects/show/#{@project}")
416+
{:ok, %{pid: pid} = view, _html_on_mount} = live(conn, "/ui/projects/show/#{@project}")
420417

421418
# We wait until the overview task has completed and the result is received by the view process, because the
422419
# overview evaluation will create a cached index.
423-
:erlang.trace(view.pid, true, [:receive])
424-
assert_receive {:trace, _, :receive, {_ref, {:overview_task, _stats}}}
420+
:erlang.trace(pid, true, [:receive])
421+
assert_receive {:trace, ^pid, :receive, {_ref, {:overview_task, _stats}}}
425422

426423
assert {:ok, %{"o26" => _value}} = Cachex.get(@index_cache_name, @project)
427424

0 commit comments

Comments
 (0)