diff --git a/.github/workflows/prjob_build.yml b/.github/workflows/prjob_build.yml deleted file mode 100644 index e7aa1f9c5..000000000 --- a/.github/workflows/prjob_build.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Build -on: - pull_request: - branches: - - master -jobs: - build: - name: build - runs-on: - - ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Install modules - run: yarn --cwd ./frontend/app install - - name: Build - run: CI=false yarn --cwd ./frontend/app run build - diff --git a/.github/workflows/prjob_eslint.yml b/.github/workflows/prjob_eslint.yml deleted file mode 100644 index 8f3247933..000000000 --- a/.github/workflows/prjob_eslint.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Eslint -on: - pull_request: - branches: - - master -jobs: - eslint: - name: eslint - runs-on: - - ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Install modules - run: yarn --cwd ./frontend/app install - - name: Eslint - run: yarn --cwd ./frontend/app run lint - diff --git a/.github/workflows/prjob_prettier.yml b/.github/workflows/prjob_prettier.yml deleted file mode 100644 index bfd1431dd..000000000 --- a/.github/workflows/prjob_prettier.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Prettier -on: - pull_request: - branches: - - master -jobs: - - prettier: - name: prettier - runs-on: - - ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Install modules - run: yarn --cwd ./frontend/app install - - name: Prettier - run: CI=false yarn --cwd ./frontend/app run prettier:check - diff --git a/.github/workflows/prjob_tests.yml b/.github/workflows/prjob_tests.yml index 62802808c..7cf70329b 100644 --- a/.github/workflows/prjob_tests.yml +++ b/.github/workflows/prjob_tests.yml @@ -1,27 +1,16 @@ -name: Tests +name: Tests on: pull_request: branches: - master jobs: - test-jest: - name: Jest - runs-on: - - ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Install modules - run: yarn --cwd ./frontend/app install - - name: Tests - run: cd ./frontend/app && NODE_OPTIONS="--max_old_space_size=8192" yarn run test-jest - test-go: - name: Go + name: Go runs-on: - ubuntu-latest steps: - uses: actions/checkout@v2 - name: Install cover run: go get golang.org/x/tools/cmd/cover - - name: Tests + - name: Tests run: go test ./... -race -v -coverprofile=coverage.out && ./cover-check.sh coverage.out 8.4 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") - } -} diff --git a/routes/index.go b/routes/index.go index 436265434..a149286ef 100644 --- a/routes/index.go +++ b/routes/index.go @@ -21,7 +21,6 @@ import ( func NewRouter() *http.Server { r := initChi() - r.Mount("/", IndexRoutes()) r.Mount("/tribes", TribeRoutes()) r.Mount("/bots", BotsRoutes()) r.Mount("/bot", BotRoutes())