2024-07-20 18:56:51 +02:00
|
|
|
package status // import nocternity.net/gomonop/pkg/status
|
2024-07-20 10:01:05 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestStatusDefaultOK(t *testing.T) {
|
|
|
|
var s Status
|
|
|
|
assert.Equal(t, StatusOK, s)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestStatusToString(t *testing.T) {
|
|
|
|
assert.Equal(t, "OK", StatusOK.String())
|
|
|
|
assert.Equal(t, "WARNING", StatusWarning.String())
|
|
|
|
assert.Equal(t, "ERROR", StatusCritical.String())
|
|
|
|
assert.Equal(t, "UNKNOWN", StatusUnknown.String())
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestStatusToInt(t *testing.T) {
|
|
|
|
assert.Equal(t, 0, int(StatusOK))
|
|
|
|
assert.Equal(t, 1, int(StatusWarning))
|
|
|
|
assert.Equal(t, 2, int(StatusCritical))
|
|
|
|
assert.Equal(t, 3, int(StatusUnknown))
|
|
|
|
}
|