package minecraft_log

import (
	"net/http"
	"net/http/httptest"
	"testing"

	"go.uber.org/zap"

	"encoding/json"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

func TestPost(t *testing.T) {
	r := Resource{
		zap.NewNop(),
	}

	w := httptest.NewRecorder()

	//authorizationRequest := TransactionAuthorizationRequest{
	//	TransactionID:  uuid.New().String(),
	//	ExternalCardID: uuid.New().String(),
	//	Amount: types.MonetaryAmount{
	//		Number:       100,
	//		CurrencyCode: "SEK",
	//	},
	//	FirstTime: false,
	//	Place:     "starbucks",
	//}
	//Body, err := json.Marshal(authorizationRequest)
	//require.NoError(t, err)
	req, err := http.NewRequest(http.MethodGet, "/minecraft-log", nil)
	require.NoError(t, err)

	r.Post(w, req)

	expected := Response{
		Started: false,
	}

	var actual Response
	err = json.NewDecoder(w.Body).Decode(&actual)
	require.NoError(t, err)

	assert.Equal(t, http.StatusOK, w.Code)
	assert.Equal(t, expected, actual)
}
