@@ -158,10 +158,11 @@ func (suite *TestSuiteStandard) TestGoalsGet() {
158158func (suite * TestSuiteStandard ) TestGoalsGetFilter () {
159159 b := createTestBudget (suite .T (), v4.BudgetEditable {})
160160
161- c := createTestCategory (suite .T (), v4.CategoryEditable {BudgetID : b .Data .ID })
161+ c1 := createTestCategory (suite .T (), v4.CategoryEditable {BudgetID : b .Data .ID })
162+ c2 := createTestCategory (suite .T (), v4.CategoryEditable {BudgetID : b .Data .ID })
162163
163- e1 := createTestEnvelope (suite .T (), v4.EnvelopeEditable {CategoryID : c .Data .ID })
164- e2 := createTestEnvelope (suite .T (), v4.EnvelopeEditable {CategoryID : c .Data .ID })
164+ e1 := createTestEnvelope (suite .T (), v4.EnvelopeEditable {CategoryID : c1 .Data .ID })
165+ e2 := createTestEnvelope (suite .T (), v4.EnvelopeEditable {CategoryID : c2 .Data .ID })
165166
166167 _ = createTestGoal (suite .T (), v4.GoalEditable {
167168 Name : "Test Goal" ,
@@ -194,33 +195,39 @@ func (suite *TestSuiteStandard) TestGoalsGetFilter() {
194195 query string
195196 len int
196197 }{
197- {"Same month" , fmt .Sprintf ("month=%s" , types .NewMonth (2024 , 1 )), 2 },
198- {"After month" , fmt .Sprintf ("fromMonth=%s" , types .NewMonth (2024 , 2 )), 1 },
199- {"Before month" , fmt .Sprintf ("untilMonth=%s" , types .NewMonth (2024 , 2 )), 3 },
200198 {"After all months" , fmt .Sprintf ("fromMonth=%s" , types .NewMonth (2024 , 6 )), 0 },
201- {"Before all months" , fmt .Sprintf ("untilMonth=%s" , types .NewMonth (2023 , 6 )), 0 },
202- {"Impossible between two months" , fmt .Sprintf ("fromMonth=%s&untilMonth=%s" , types .NewMonth (2024 , 11 ), types .NewMonth (2024 , 10 )), 0 },
203- {"Exact Amount" , fmt .Sprintf ("amount=%s" , decimal .NewFromFloat (200 ).String ()), 1 },
204- {"Note" , "note=can" , 1 },
205- {"No note" , "note=" , 1 },
206- {"Fuzzy note" , "note=so" , 2 },
199+ {"After month" , fmt .Sprintf ("fromMonth=%s" , types .NewMonth (2024 , 2 )), 1 },
207200 {"Amount less or equal to 99" , "amountLessOrEqual=99" , 0 },
208201 {"Amount less or equal to 200" , "amountLessOrEqual=200" , 2 },
209202 {"Amount more or equal to 3" , "amountMoreOrEqual=3" , 3 },
203+ {"Amount more or equal to 50 and less than 500" , "amountMoreOrEqual=50&amountLessOrEqual=500" , 2 },
204+ {"Amount more or equal to 100 and less than 10" , "amountMoreOrEqual=100&amountLessOrEqual=10" , 0 },
210205 {"Amount more or equal to 500.813" , "amountMoreOrEqual=500.813" , 1 },
211206 {"Amount more or equal to 99999" , "amountMoreOrEqual=99999" , 0 },
212- {"Amount more or equal to 100 and less than 10" , "amountMoreOrEqual=100&amountLessOrEqual=10" , 0 },
213- {"Amount more or equal to 50 and less than 500" , "amountMoreOrEqual=50&amountLessOrEqual=500" , 2 },
207+ {"Before all months" , fmt .Sprintf ("untilMonth=%s" , types .NewMonth (2023 , 6 )), 0 },
208+ {"Before month" , fmt .Sprintf ("untilMonth=%s" , types .NewMonth (2024 , 2 )), 3 },
209+ {"Budget matches" , fmt .Sprintf ("budget=%s" , b .Data .ID ), 3 },
210+ {"Budget does not match" , fmt .Sprintf ("budget=%s" , uuid .New ()), 0 },
211+ {"Category 1" , fmt .Sprintf ("category=%s" , c1 .Data .ID ), 2 },
212+ {"Category 1, but budget does not match" , fmt .Sprintf ("category=%s&budget=%s" , c1 .Data .ID , uuid .New ()), 0 },
213+ {"Category 2" , fmt .Sprintf ("category=%s" , c2 .Data .ID ), 1 },
214+ {"Category does not match" , fmt .Sprintf ("category=%s" , uuid .New ()), 0 },
215+ {"Exact Amount" , fmt .Sprintf ("amount=%s" , decimal .NewFromFloat (200 ).String ()), 1 },
216+ {"Fuzzy note" , "note=so" , 2 },
217+ {"Impossible between two months" , fmt .Sprintf ("fromMonth=%s&untilMonth=%s" , types .NewMonth (2024 , 11 ), types .NewMonth (2024 , 10 )), 0 },
218+ {"Limit and Fuzzy Note" , "limit=1¬e=so" , 1 },
219+ {"Limit and Offset" , "limit=1&offset=1" , 1 },
220+ {"Limit negative" , "limit=-123" , 3 },
214221 {"Limit positive" , "limit=2" , 2 },
215- {"Limit zero" , "limit=0" , 0 },
216222 {"Limit unset" , "limit=-1" , 3 },
217- {"Limit negative" , "limit=-123" , 3 },
218- {"Offset zero" , "offset=0" , 3 },
219- {"Offset positive" , "offset=2" , 1 },
220- {"Offset higher than number" , "offset=5" , 0 },
221- {"Limit and Offset" , "limit=1&offset=1" , 1 },
222- {"Limit and Fuzzy Note" , "limit=1¬e=so" , 1 },
223+ {"Limit zero" , "limit=0" , 0 },
224+ {"No note" , "note=" , 1 },
225+ {"Note" , "note=can" , 1 },
223226 {"Offset and Fuzzy Note" , "offset=2¬e=they" , 0 },
227+ {"Offset higher than number" , "offset=5" , 0 },
228+ {"Offset positive" , "offset=2" , 1 },
229+ {"Offset zero" , "offset=0" , 3 },
230+ {"Same month" , fmt .Sprintf ("month=%s" , types .NewMonth (2024 , 1 )), 2 },
224231 }
225232
226233 for _ , tt := range tests {
0 commit comments