-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogLevel_test.go
53 lines (39 loc) · 896 Bytes
/
logLevel_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
package jobrunner
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestString_NonSupportedLogLevels(t *testing.T) {
// arrange
var unsupportedValue = maxLogLevel
// SUT
var sut = LogLevel(unsupportedValue)
// act
var result = sut.String()
// assert
assert.Equal(t, debugLogLevelName, result)
}
func TestString_SupportedLogLevel(t *testing.T) {
// SUT
var sut = LogLevelError
// act
var result = sut.String()
// assert
assert.Equal(t, errorLogLevelName, result)
}
func TestNewLogLevel_NoMatchFound(t *testing.T) {
// arrange
var dummyValue = "some value"
// SUT + act
var result = NewLogLevel(dummyValue)
// assert
assert.Equal(t, LogLevelDebug, result)
}
func TestNewLogLevel_HappyPath(t *testing.T) {
for key, value := range logLevelNameMapping {
// SUT + act
var result = NewLogLevel(key)
// assert
assert.Equal(t, value, result)
}
}