feat: turn generate api
This commit is contained in:
@@ -28,9 +28,10 @@ func TestGetStatus(t *testing.T) {
|
||||
r.ServeHTTP(w, req)
|
||||
|
||||
assert.Equal(t, http.StatusCreated, w.Code, w.Body)
|
||||
var initResponse rest.InitResponse
|
||||
var initResponse rest.StateResponse
|
||||
assert.NoError(t, json.Unmarshal(w.Body.Bytes(), &initResponse))
|
||||
assert.NoError(t, uuid.Validate(initResponse.UUID.String()))
|
||||
assert.NoError(t, uuid.Validate(initResponse.ID.String()))
|
||||
assert.NotEqual(t, uuid.Nil, uuid.MustParse(initResponse.ID.String()))
|
||||
|
||||
w = httptest.NewRecorder()
|
||||
req, _ = http.NewRequest("GET", "/api/v1/status", nil)
|
||||
@@ -40,6 +41,7 @@ func TestGetStatus(t *testing.T) {
|
||||
var stateResponse rest.StateResponse
|
||||
assert.NoError(t, json.Unmarshal(w.Body.Bytes(), &stateResponse))
|
||||
assert.NoError(t, uuid.Validate(stateResponse.ID.String()))
|
||||
assert.Equal(t, initResponse.ID, stateResponse.ID)
|
||||
assert.Equal(t, uint(0), stateResponse.Turn)
|
||||
assert.Equal(t, uint(0), stateResponse.Stage)
|
||||
assert.Len(t, stateResponse.Players, 10)
|
||||
|
||||
Reference in New Issue
Block a user