blocky/resolver/resolver_test.go

30 lines
793 B
Go
Raw Normal View History

2020-02-13 21:50:39 +01:00
package resolver
import (
2021-08-25 22:06:34 +02:00
"github.com/0xERR0R/blocky/config"
2020-02-13 21:50:39 +01:00
2020-05-04 22:20:13 +02:00
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
2020-02-13 21:50:39 +01:00
)
2020-05-04 22:20:13 +02:00
var _ = Describe("Resolver", func() {
Describe("Creating resolver chain", func() {
When("A chain of resolvers will be created", func() {
It("should be iterable by calling 'GetNext'", func() {
2021-02-04 21:59:41 +01:00
ch := Chain(NewBlockingResolver(config.BlockingConfig{}), NewClientNamesResolver(config.ClientLookupConfig{}))
2020-05-04 22:20:13 +02:00
c, ok := ch.(ChainedResolver)
Expect(ok).Should(BeTrue())
2020-02-13 21:50:39 +01:00
2020-05-04 22:20:13 +02:00
next := c.GetNext()
Expect(next).ShouldNot(BeNil())
})
})
When("'Name' will be called", func() {
It("should return resolver name", func() {
2021-02-04 21:59:41 +01:00
name := Name(NewBlockingResolver(config.BlockingConfig{}))
2020-05-04 22:20:13 +02:00
Expect(name).Should(Equal("BlockingResolver"))
})
})
})
})