caddy/config/setup/gzip_test.go
2015-05-07 13:11:03 -06:00

30 lines
558 B
Go

package setup
import (
"testing"
"github.com/mholt/caddy/middleware/gzip"
)
func TestGzip(t *testing.T) {
c := newTestController(`gzip`)
mid, err := Gzip(c)
if err != nil {
t.Errorf("Expected no errors, but got: %v", err)
}
if mid == nil {
t.Fatal("Expected middleware, was nil instead")
}
handler := mid(emptyNext)
myHandler, ok := handler.(gzip.Gzip)
if !ok {
t.Fatalf("Expected handler to be type Gzip, got: %#v", handler)
}
if !sameNext(myHandler.Next, emptyNext) {
t.Error("'Next' field of handler was not set properly")
}
}