-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathseverity_test.go
38 lines (30 loc) · 1.2 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
package sentry
import (
"testing"
"github.com/stretchr/testify/assert"
)
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) {
assert.NotNil(t, testGetOptionsProvider(t, Level(Info)), "it should be registered as a default option")
o := Level(Error)
assert.NotNil(t, o, "should not return a nil option")
assert.Implements(t, (*Option)(nil), o, "it should implement the Option interface")
assert.Equal(t, "level", o.Class(), "it should use the right option class")
t.Run("MarshalJSON()", func(t *testing.T) {
assert.Equal(t, "error", testOptionsSerialize(t, o), "it should serialize to a string")
})
assert.EqualValues(t, Fatal, "fatal", "fatal should use the correct name")
assert.EqualValues(t, Error, "error", "fatal should use the correct name")
assert.EqualValues(t, Warning, "warning", "fatal should use the correct name")
assert.EqualValues(t, Info, "info", "fatal should use the correct name")
assert.EqualValues(t, Debug, "debug", "fatal should use the correct name")
}