Skip to content

Commit 42c790a

Browse files
committed
add missing file for 46fb6dc
1 parent 8765d24 commit 42c790a

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

test/support/async_sync.ex

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
defmodule Phoenix.LiveViewTest.Support.AsyncSync do
2+
def wait_for_async_ready_and_monitor(name) do
3+
receive do
4+
:async_ready -> :ok
5+
end
6+
7+
async_ref = Process.monitor(name)
8+
send(name, :monitoring)
9+
10+
receive do
11+
:monitoring_received -> :ok
12+
end
13+
14+
async_ref
15+
end
16+
17+
def register_and_sleep(notify_name, register_name) do
18+
Process.register(self(), register_name)
19+
send(notify_name, :async_ready)
20+
21+
receive do
22+
:monitoring ->
23+
send(notify_name, :monitoring_received)
24+
Process.sleep(:infinity)
25+
end
26+
end
27+
end

0 commit comments

Comments
 (0)