diff options
-rw-r--r-- | svc/init_test.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/svc/init_test.go b/svc/init_test.go index 7ddd563..0c417b4 100644 --- a/svc/init_test.go +++ b/svc/init_test.go @@ -1,12 +1,14 @@ package svc // import "github.com/getwtxt/getwtxt/svc" import ( + "bytes" "fmt" "log" "net" "os" "strings" "sync" + "testing" "github.com/getwtxt/registry" "github.com/spf13/viper" @@ -115,3 +117,16 @@ func killStatuses() { user.Mu.Unlock() twtxtCache.Mu.Unlock() } + +func Test_errLog(t *testing.T) { + t.Run("Log to Buffer", func(t *testing.T) { + b := []byte{} + buf := bytes.NewBuffer(b) + log.SetOutput(buf) + err := fmt.Errorf("test error") + errLog("", err) + if !strings.Contains(buf.String(), "test error") { + t.Errorf("Output Incorrect: %#v\n", buf.String()) + } + }) +} |