-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathray_test.go
44 lines (38 loc) · 876 Bytes
/
ray_test.go
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
package ray
import (
"bytes"
"net/http"
"strings"
"testing"
)
type TestJsonStruct struct {
FieldA string `json:"fieldA"`
FIeldB string `json:"fieldB"`
}
func Test(t *testing.T) {
t.Parallel()
entry := NewRayEntry(DefaultClient, "")
// entry.WithColor("green").Notify("huhu")
entry.NewScreen("my screen")
entry.TypeName(int64(4343))
entry.Ray([]interface{}{"huhu", "Jo"})
entry.WithColor("green").Caller()
entry.Charles()
entry.Trace()
entry.JSONString("{\"fieldA\": 234}")
entry.JSON(TestJsonStruct{
FieldA: "hallo",
FIeldB: "welt",
})
entry.DumpStruct(&TestJsonStruct{
FieldA: "hallo",
FIeldB: "welt",
})
req, err := http.NewRequest("POST", "/health-check", strings.NewReader("{\"fieldA\": 234}"))
if err != nil {
t.Fatal(err)
}
entry.Request(req)
buf := bytes.NewBufferString("öjk<html>\n<bla>\n</bla></html>")
entry.Reader(buf)
}