@@ -2,19 +2,23 @@ package controllers_test
22
33import (
44 "net/http"
5+ "testing"
6+ "time"
57
68 "github.com/envelope-zero/backend/pkg/models"
79 "github.com/envelope-zero/backend/test"
810 "github.com/shopspring/decimal"
11+ "github.com/stretchr/testify/assert"
912)
1013
1114func (suite * TestSuiteStandard ) TestCleanup () {
1215 _ = suite .createTestBudget (models.BudgetCreate {})
1316 _ = suite .createTestAccount (models.AccountCreate {})
1417 _ = suite .createTestCategory (models.CategoryCreate {})
15- _ = suite .createTestEnvelope (models.EnvelopeCreate {})
18+ envelope : = suite .createTestEnvelope (models.EnvelopeCreate {})
1619 _ = suite .createTestAllocation (models.AllocationCreate {})
1720 _ = suite .createTestTransaction (models.TransactionCreate {Amount : decimal .NewFromFloat (17.32 )})
21+ _ = suite .createTestMonthConfig (envelope .Data .ID , time .Now (), models.MonthConfigCreate {})
1822
1923 tests := []string {
2024 "http://example.com/v1/budgets" ,
@@ -23,6 +27,7 @@ func (suite *TestSuiteStandard) TestCleanup() {
2327 "http://example.com/v1/transactions" ,
2428 "http://example.com/v1/envelopes" ,
2529 "http://example.com/v1/allocations" ,
30+ "http://example.com/v1/month-configs" ,
2631 }
2732
2833 // Delete
@@ -31,7 +36,7 @@ func (suite *TestSuiteStandard) TestCleanup() {
3136
3237 // Verify
3338 for _ , tt := range tests {
34- suite .Run (tt , func () {
39+ suite .T (). Run (tt , func (t * testing. T ) {
3540 recorder := test .Request (suite .controller , suite .T (), http .MethodGet , tt , "" )
3641 suite .assertHTTPStatus (& recorder , http .StatusOK )
3742
@@ -40,7 +45,7 @@ func (suite *TestSuiteStandard) TestCleanup() {
4045 }
4146
4247 suite .decodeResponse (& recorder , & response )
43- suite . Assert (). Len (response .Data , 0 , "There are resources left for type %s" , tt )
48+ assert . Len (t , response .Data , 0 , "There are resources left for type %s" , tt )
4449 })
4550 }
4651}
0 commit comments