refactor: executors and routers
* refactor: executors and routers
This commit is contained in:
@@ -2,7 +2,6 @@ package router_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
@@ -11,6 +10,7 @@ import (
|
||||
"github.com/iliadenisov/galaxy/internal/controller"
|
||||
"github.com/iliadenisov/galaxy/internal/model/rest"
|
||||
"github.com/iliadenisov/galaxy/internal/router"
|
||||
"github.com/iliadenisov/galaxy/internal/router/handler"
|
||||
"github.com/iliadenisov/galaxy/internal/util"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -19,7 +19,7 @@ func TestInit(t *testing.T) {
|
||||
root, cleanup := util.CreateWorkDir(t)
|
||||
defer cleanup()
|
||||
|
||||
r := router.SetupRouterConfig(func(p *controller.Param) { p.StoragePath = root })
|
||||
r := router.SetupRouter(handler.NewDefaultConfigExecutor(func(p *controller.Param) { p.StoragePath = root }))
|
||||
|
||||
payload := generateInitRequest(10)
|
||||
|
||||
@@ -34,7 +34,7 @@ func TestInit(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInitValidators(t *testing.T) {
|
||||
r := router.SetupRouter()
|
||||
r := setupRouter()
|
||||
payload := generateInitRequest(9)
|
||||
|
||||
w := httptest.NewRecorder()
|
||||
@@ -43,13 +43,3 @@ func TestInitValidators(t *testing.T) {
|
||||
|
||||
assert.Equal(t, http.StatusBadRequest, w.Code, w.Body)
|
||||
}
|
||||
|
||||
func generateInitRequest(races int) rest.Init {
|
||||
request := rest.Init{
|
||||
Races: make([]rest.Race, races),
|
||||
}
|
||||
for i := range request.Races {
|
||||
request.Races[i] = rest.Race{Name: fmt.Sprintf("Race_%02d", i)}
|
||||
}
|
||||
return request
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user