some library updates and adds support for adblock lists
This commit is contained in:
40
internal/config/struct-config_test.go
Normal file
40
internal/config/struct-config_test.go
Normal file
@ -0,0 +1,40 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"log/slog"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gitlab.smoothnet.org/nhyatt/bind-response-policy-zone-creator/internal/log"
|
||||
)
|
||||
|
||||
func slogToBuffer() (*bytes.Buffer, *slog.Logger) {
|
||||
buf := new(bytes.Buffer)
|
||||
return buf, slog.New(
|
||||
slog.NewTextHandler(
|
||||
buf,
|
||||
&slog.HandlerOptions{
|
||||
Level: log.LevelTrace,
|
||||
},
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
func TestPrintRunningConfig(t *testing.T) {
|
||||
buf, l := slogToBuffer()
|
||||
log.L.Log = l
|
||||
|
||||
c := New()
|
||||
cfgInfo, err := getStructInfo(&c)
|
||||
assert.NoError(t, err)
|
||||
printRunningConfig(&c, cfgInfo)
|
||||
|
||||
assert.Contains(t, buf.String(), "Running Configuration")
|
||||
}
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
c := New()
|
||||
assert.Equal(t, "config.Config", reflect.TypeOf(c).String())
|
||||
}
|
Reference in New Issue
Block a user