mirror of https://github.com/0xERR0R/blocky.git
57 lines
1.0 KiB
Go
57 lines
1.0 KiB
Go
package resolver
|
|
|
|
import (
|
|
"context"
|
|
|
|
. "github.com/0xERR0R/blocky/helpertest"
|
|
"github.com/0xERR0R/blocky/log"
|
|
. "github.com/onsi/ginkgo/v2"
|
|
. "github.com/onsi/gomega"
|
|
)
|
|
|
|
var _ = Describe("NoOpResolver", func() {
|
|
var (
|
|
sut *NoOpResolver
|
|
|
|
ctx context.Context
|
|
cancelFn context.CancelFunc
|
|
)
|
|
|
|
Describe("Type", func() {
|
|
It("follows conventions", func() {
|
|
expectValidResolverType(sut)
|
|
})
|
|
})
|
|
|
|
BeforeEach(func() {
|
|
ctx, cancelFn = context.WithCancel(context.Background())
|
|
DeferCleanup(cancelFn)
|
|
|
|
sut = NewNoOpResolver()
|
|
})
|
|
|
|
Describe("Resolving", func() {
|
|
It("returns no response", func() {
|
|
resp, err := sut.Resolve(ctx, newRequest("test.tld", A))
|
|
Expect(err).Should(Succeed())
|
|
Expect(resp).Should(Equal(NoResponse))
|
|
})
|
|
})
|
|
|
|
Describe("IsEnabled", func() {
|
|
It("is true", func() {
|
|
Expect(sut.IsEnabled()).Should(BeTrue())
|
|
})
|
|
})
|
|
|
|
Describe("LogConfig", func() {
|
|
It("should not log anything", func() {
|
|
logger, hook := log.NewMockEntry()
|
|
|
|
sut.LogConfig(logger)
|
|
|
|
Expect(hook.Calls).Should(BeEmpty())
|
|
})
|
|
})
|
|
})
|