sixth version
This commit is contained in:
@@ -25,3 +25,15 @@ func TestFreeOrderBudgetSubmittedPolicy(t *testing.T) {
|
||||
t.Fatalf("expected ErrFreeOrderBudget, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFreeOrderBudgetRequiresExplicitPolicy(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
budget := NewFreeOrderBudget(NewMemoryFreeOrderStore())
|
||||
date := time.Date(2024, 1, 2, 0, 0, 0, 0, time.UTC)
|
||||
if _, err := budget.Check(ctx, date, domain.Instrument{InstrumentUID: "uid"}, 1); !errors.Is(err, ErrFreeOrderPolicyUnspecified) {
|
||||
t.Fatalf("expected ErrFreeOrderPolicyUnspecified, got %v", err)
|
||||
}
|
||||
if _, err := budget.Check(ctx, date, domain.Instrument{InstrumentUID: "uid", FreeOrderLimitPerDay: -1}, 1); err != nil {
|
||||
t.Fatalf("explicit no-cap policy should pass, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user