From d7e9a705fd0a90709f28e07ef0ee5ee68aa3ed30 Mon Sep 17 00:00:00 2001 From: elraphty Date: Mon, 29 Jan 2024 21:37:23 +0100 Subject: [PATCH] removed sphinx-tribes.exe from history --- routes/frontend.go | 46 ------------------------------- routes/frontend_test.go | 61 ----------------------------------------- 2 files changed, 107 deletions(-) delete mode 100644 routes/frontend.go delete mode 100644 routes/frontend_test.go diff --git a/routes/frontend.go b/routes/frontend.go deleted file mode 100644 index 56c62fb3e..000000000 --- a/routes/frontend.go +++ /dev/null @@ -1,46 +0,0 @@ -package routes - -import ( - "github.com/go-chi/chi" - "github.com/stakwork/sphinx-tribes/frontend" -) - -func IndexRoutes() chi.Router { - r := chi.NewRouter() - r.Get("/ping", frontend.PingRoute) - r.Group(func(r chi.Router) { - r.Get("/", frontend.IndexRoute) - r.Get("/static/*", frontend.StaticRoute) - r.Get("/manifest.json", frontend.ManifestRoute) - r.Get("/favicon.ico", frontend.FaviconRoute) - }) - r.Group(func(r chi.Router) { - r.Get("/t/static/*", frontend.StaticRoute) - r.Get("/t/manifest.json", frontend.ManifestRoute) - r.Get("/t/favicon.ico", frontend.FaviconRoute) - r.Get("/t/{unique_name}", frontend.IndexRoute) - r.Get("/t", frontend.IndexRoute) - }) - r.Group(func(r chi.Router) { - r.Get("/p/static/*", frontend.StaticRoute) - r.Get("/p/manifest.json", frontend.ManifestRoute) - r.Get("/p/favicon.ico", frontend.FaviconRoute) - r.Get("/p/{pubkey}", frontend.IndexRoute) - r.Get("/p", frontend.IndexRoute) - r.Get("/p/{pubkey}/offer", frontend.IndexRoute) - r.Get("/p/{pubkey}/badges", frontend.IndexRoute) - r.Get("/p/{pubkey}/wanted", frontend.IndexRoute) - r.Get("/p/{pubkey}/wanted/{page}/{index}", frontend.IndexRoute) - r.Get("/p/{pubkey}/usertickets", frontend.IndexRoute) - r.Get("/p/{pubkey}/usertickets/{ticket_id}/{index}", frontend.IndexRoute) - r.Get("/p/{pubkey}/organizations", frontend.IndexRoute) - r.Get("/b", frontend.IndexRoute) - r.Get("/tickets", frontend.IndexRoute) - r.Get("/bounties", frontend.IndexRoute) - r.Get("/bounty/*", frontend.IndexRoute) - r.Get("/leaderboard", frontend.IndexRoute) - r.Get("/org/bounties/*", frontend.IndexRoute) - r.Get("/admin", frontend.IndexRoute) - }) - return r -} diff --git a/routes/frontend_test.go b/routes/frontend_test.go deleted file mode 100644 index fde6e5590..000000000 --- a/routes/frontend_test.go +++ /dev/null @@ -1,61 +0,0 @@ -package routes - -import ( - "encoding/json" - "net/http" - "net/http/httptest" - "strings" - "testing" - - "github.com/stakwork/sphinx-tribes/frontend" -) - -func TestPingRoute(t *testing.T) { - var result string = "pong" - req, err := http.NewRequest("GET", "/ping", nil) - - if err != nil { - t.Errorf("Error creating a new request: %v", err) - } - - rr := httptest.NewRecorder() - handler := http.HandlerFunc(frontend.PingRoute) - - handler.ServeHTTP(rr, req) - - if status := rr.Code; status != http.StatusOK { - t.Errorf("Handler returned wrong status code. Expected: %d. Got: %d.", http.StatusOK, status) - } - - var response string - - if err := json.NewDecoder(rr.Body).Decode(&response); err != nil { - t.Errorf("Error decoding response body: %v", err) - } - - if response != result { - t.Errorf("Expected: %v. Got: %v.", response, result) - } -} - -func TestIndexRoute(t *testing.T) { - var result string = "Sphinx Community" - req, err := http.NewRequest("GET", "/", nil) - - if err != nil { - t.Errorf("Error creating a new request: %v", err) - } - - rr := httptest.NewRecorder() - handler := http.HandlerFunc(frontend.IndexRoute) - - handler.ServeHTTP(rr, req) - - if status := rr.Code; status != http.StatusOK { - t.Errorf("Handler returned wrong status code. Expected: %d. Got: %d.", http.StatusOK, status) - } - - if !strings.Contains(rr.Body.String(), result) { - t.Error("Not the Index Page") - } -}