From ab0385a61e8525298fb00d0255c9414aedd3f14d Mon Sep 17 00:00:00 2001 From: H1rono Date: Sat, 9 Nov 2024 00:45:12 +0900 Subject: [PATCH] :white_check_mark: Pass test --- router/transaction_test.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/router/transaction_test.go b/router/transaction_test.go index 880263c9..f26523a6 100644 --- a/router/transaction_test.go +++ b/router/transaction_test.go @@ -650,9 +650,10 @@ func TestHandlers_PostTransaction(t *testing.T) { group := tx1.Group.ID e := echo.New() + // FIXME: json.Marshalを使う reqBody := fmt.Sprintf( - `{"amount": %d, "targets": ["%s"], "tags": ["%s"], "group": "%s"}`, - tx1.Amount, tx1.Target, tag.ID, group) + `{"title": "%s", "amount": %d, "targets": ["%s"], "tags": ["%s"], "group": "%s"}`, + tx1.Title, tx1.Amount, tx1.Target, tag.ID, group) req, err := http.NewRequest( http.MethodPost, "/api/transactions", @@ -767,9 +768,10 @@ func TestHandlers_PostTransaction(t *testing.T) { } e := echo.New() + // FIXME: json.Marshalを使う reqBody := fmt.Sprintf( - `{"amount": %d, "targets": ["%s"], "tags": ["%s"], "group": "%s", "request": "%s"}`, - tx.Amount, tx.Target, tag.ID, group, request.ID) + `{"title": "%s", "amount": %d, "targets": ["%s"], "tags": ["%s"], "group": "%s", "request": "%s"}`, + tx.Title, tx.Amount, tx.Target, tag.ID, group, request.ID) req, err := http.NewRequest( http.MethodPost, "/api/transactions", @@ -827,6 +829,9 @@ func TestHandlers_PostTransaction(t *testing.T) { assert.Equal(t, string(resBody), strings.TrimRight(rec.Body.String(), "\n")) } }) + + // TODO: FailWithoutTitle + // PostTransactionにvalidationが入ってから } func TestHandlers_GetTransaction(t *testing.T) {