forked from SierraSoftworks/sentry-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseverity_test.go
58 lines (47 loc) · 1.29 KB
/
severity_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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package sentry
import (
"encoding/json"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func ExampleLevel() {
cl := NewClient(
// You can set the severity level when you create your client
Level(Debug),
)
cl.Capture(
// You can also specify it when sending an event
Level(Error),
)
}
func TestSeverity(t *testing.T) {
Convey("Severity", t, func() {
Convey("Level()", func() {
Convey("Should use the correct Class()", func() {
So(Level(Error).Class(), ShouldEqual, "level")
})
Convey("MarshalJSON", func() {
Convey("Should marshal to a string", func() {
b, err := json.Marshal(Level(Error))
So(err, ShouldBeNil)
So(string(b), ShouldEqual, `"error"`)
})
})
})
Convey("Fatal should use the correct name", func() {
So(string(Fatal), ShouldEqual, "fatal")
})
Convey("Error should use the correct name", func() {
So(string(Error), ShouldEqual, "error")
})
Convey("Warning should use the correct name", func() {
So(string(Warning), ShouldEqual, "warning")
})
Convey("Info should use the correct name", func() {
So(string(Info), ShouldEqual, "info")
})
Convey("Debug should use the correct name", func() {
So(string(Debug), ShouldEqual, "debug")
})
})
}