some library updates and adds support for adblock lists

This commit is contained in:
2025-05-02 20:57:03 -05:00
parent 03b1cc13ee
commit ce4b4a11ff
19 changed files with 712 additions and 139 deletions

View 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())
}