udemy-go-web-1/cmd/web/middleware_test.go

46 lines
674 B
Go
Raw Permalink Normal View History

package main
import (
"net/http"
"testing"
)
func TestNoSurf(t *testing.T) {
var myH myHandler
h := NoSurf(&myH)
switch v := h.(type) {
case http.Handler:
// do nothing
default:
t.Errorf("type is not http.Handler, but is %T", v)
}
}
func TestSessionLoad(t *testing.T) {
var myH myHandler
s := SessionLoad(&myH)
switch v := s.(type) {
case http.Handler:
// do nothing
default:
t.Errorf("type is not http.Handler, but is %T", v)
}
}
func TestWriteToConsole(t *testing.T) {
var myH myHandler
w := WriteToConsole(&myH)
switch v := w.(type) {
case http.Handler:
// do nothing
default:
t.Errorf("type is not http.Handler, but is %T", v)
}
}