MCPcopy
hub / github.com/go-chi/chi / TestMuxBig

Function TestMuxBig

mux_test.go:885–954  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

883}
884
885func TestMuxBig(t *testing.T) {
886 r := bigMux()
887
888 ts := httptest.NewServer(r)
889 defer ts.Close()
890
891 var body, expected string
892
893 _, body = testRequest(t, ts, "GET", "/favicon.ico", nil)
894 if body != "fav" {
895 t.Fatalf("got '%s'", body)
896 }
897 _, body = testRequest(t, ts, "GET", "/hubs/4/view", nil)
898 if body != "/hubs/4/view reqid:1 session:anonymous" {
899 t.Fatalf("got '%v'", body)
900 }
901 _, body = testRequest(t, ts, "GET", "/hubs/4/view/index.html", nil)
902 if body != "/hubs/4/view/index.html reqid:1 session:anonymous" {
903 t.Fatalf("got '%s'", body)
904 }
905 _, body = testRequest(t, ts, "POST", "/hubs/ethereumhub/view/index.html", nil)
906 if body != "/hubs/ethereumhub/view/index.html reqid:1 session:anonymous" {
907 t.Fatalf("got '%s'", body)
908 }
909 _, body = testRequest(t, ts, "GET", "/", nil)
910 if body != "/ reqid:1 session:elvis" {
911 t.Fatalf("got '%s'", body)
912 }
913 _, body = testRequest(t, ts, "GET", "/suggestions", nil)
914 if body != "/suggestions reqid:1 session:elvis" {
915 t.Fatalf("got '%s'", body)
916 }
917 _, body = testRequest(t, ts, "GET", "/woot/444/hiiii", nil)
918 if body != "/woot/444/hiiii" {
919 t.Fatalf("got '%s'", body)
920 }
921 _, body = testRequest(t, ts, "GET", "/hubs/123", nil)
922 expected = "/hubs/123 reqid:1 session:elvis"
923 if body != expected {
924 t.Fatalf("expected:%s got:%s", expected, body)
925 }
926 _, body = testRequest(t, ts, "GET", "/hubs/123/touch", nil)
927 if body != "/hubs/123/touch reqid:1 session:elvis" {
928 t.Fatalf("got '%s'", body)
929 }
930 _, body = testRequest(t, ts, "GET", "/hubs/123/webhooks", nil)
931 if body != "/hubs/123/webhooks reqid:1 session:elvis" {
932 t.Fatalf("got '%s'", body)
933 }
934 _, body = testRequest(t, ts, "GET", "/hubs/123/posts", nil)
935 if body != "/hubs/123/posts reqid:1 session:elvis" {
936 t.Fatalf("got '%s'", body)
937 }
938 _, body = testRequest(t, ts, "GET", "/folders", nil)
939 if body != "404 page not found\n" {
940 t.Fatalf("got '%s'", body)
941 }
942 _, body = testRequest(t, ts, "GET", "/folders/", nil)

Callers

nothing calls this directly

Calls 3

bigMuxFunction · 0.85
CloseMethod · 0.80
testRequestFunction · 0.70

Tested by

no test coverage detected