Skip to content

Commit

Permalink
✅ Pass test
Browse files Browse the repository at this point in the history
  • Loading branch information
H1rono committed Nov 8, 2024
1 parent 4bdf341 commit ab0385a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions router/transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit ab0385a

Please sign in to comment.