-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathtrace_display_test.exs
More file actions
39 lines (32 loc) · 994 Bytes
/
trace_display_test.exs
File metadata and controls
39 lines (32 loc) · 994 Bytes
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
defmodule LiveDebugger.Structs.TraceDisplayTest do
use ExUnit.Case, async: true
alias LiveDebugger.Structs.TraceDisplay
alias LiveDebugger.Structs.Trace
@trace %Trace{
id: 1,
module: LiveDebuggerTest.TestView,
function: :handle_event,
arity: 3,
args: ["event", %{"key" => "value"}, %{}],
socket_id: "socket_id",
transport_pid: self(),
pid: self(),
cid: nil,
timestamp: System.system_time(:millisecond)
}
test "from_trace/1 creates a TraceDisplay struct" do
trace = @trace
trace_display = TraceDisplay.from_trace(trace)
assert %TraceDisplay{id: 1, trace: ^trace, render_body?: false} = trace_display
end
test "render_body/1 sets render_body? to true" do
trace_display = %TraceDisplay{
id: 1,
trace: @trace,
render_body?: false,
counter: 0
}
updated_trace_display = TraceDisplay.render_body(trace_display)
assert %TraceDisplay{render_body?: true} = updated_trace_display
end
end