app_test.go 507 B

12345678910111213141516171819202122232425262728293031
  1. package complete
  2. import (
  3. "net/http"
  4. "testing"
  5. "github.com/cryptix/exp/multiModulePage/router"
  6. "github.com/cryptix/go/http/tester"
  7. )
  8. var (
  9. testMux *http.ServeMux
  10. testClient *tester.Tester
  11. testRouter = router.CompleteApp()
  12. )
  13. func setup(t *testing.T) {
  14. testMux = http.NewServeMux()
  15. h, err := Handler(testRouter)
  16. if err != nil {
  17. t.Fatalf("handler setup failed: %s", err)
  18. }
  19. testMux.Handle("/", h)
  20. testClient = tester.New(testMux, t)
  21. }
  22. func teardown() {
  23. testMux = nil
  24. testClient = nil
  25. }