-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathprocess_case.ex
93 lines (86 loc) · 2.55 KB
/
process_case.ex
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
defmodule LiveDebugger.ProcessCase do
@moduledoc false
use ExUnit.CaseTemplate
import Mox
setup _ do
pid = :c.pid(0, 0, 0)
stub(LiveDebugger.MockLiveViewScraper, :pid_by_socket_id, fn _socket_id ->
{:ok, pid}
end)
stub(LiveDebugger.MockLiveViewScraper, :pids, fn ->
[pid]
end)
stub(LiveDebugger.MockLiveViewScraper, :channel_state_from_pid, fn _pid ->
{:ok,
%{
socket: %{
id: "phx-live-view-id",
view: DbgPocWeb.Root,
assigns: %{
name: "David",
socket_id: "phx-socket-id"
},
root_pid: pid
},
components:
{%{
1 =>
{DbgPocWeb.LiveComponents.First, "live_first",
%{
name: "David",
myself: %Phoenix.LiveComponent.CID{cid: 1}
},
%{
children_cids: [4, 3]
}, :empty},
2 =>
{DbgPocWeb.LiveComponents.Second, "live_second",
%{
id: "live_second",
myself: %Phoenix.LiveComponent.CID{cid: 2}
},
%{
children_cids: []
}, :empty},
3 =>
{DbgPocWeb.LiveComponents.Second, "live_third",
%{
id: "live_third",
myself: %Phoenix.LiveComponent.CID{cid: 3}
},
%{
children_cids: []
}, :empty},
4 =>
{DbgPocWeb.LiveComponents.Second, "live_fourth",
%{
id: "live_fourth",
myself: %Phoenix.LiveComponent.CID{cid: 4}
},
%{
children_cids: [5]
}, :empty},
5 =>
{DbgPocWeb.LiveComponents.Second, "live_fifth",
%{
id: "live_fifth",
myself: %Phoenix.LiveComponent.CID{cid: 5}
},
%{
children_cids: []
}, :empty}
},
%{
DbgPocWeb.LiveComponents.First => %{"live_first" => 1},
DbgPocWeb.LiveComponents.Second => %{
"live_third" => 3,
"live_second" => 2,
"live_fourth" => 4,
"live_fith" => 5
}
}, 6}
}}
end)
{:ok, pid: pid}
end
end