package handler

import "testing"

func TestValidateRedemptionBatchLimits(t *testing.T) {
	tests := []struct {
		name     string
		points   any
		quantity int
		wantErr  bool
	}{
		{name: "minimum", points: 1, quantity: 1},
		{name: "maximum", points: 100, quantity: 10},
		{name: "decimal points", points: 1.5, quantity: 2},
		{name: "points below minimum", points: 0.99, quantity: 1, wantErr: true},
		{name: "points above maximum", points: 100.01, quantity: 1, wantErr: true},
		{name: "quantity below minimum", points: 1, quantity: 0, wantErr: true},
		{name: "quantity above maximum", points: 1, quantity: 11, wantErr: true},
		{name: "invalid points", points: "invalid", quantity: 1, wantErr: true},
	}
	for _, test := range tests {
		t.Run(test.name, func(t *testing.T) {
			_, err := validateRedemptionBatchLimits(test.points, test.quantity)
			if (err != nil) != test.wantErr {
				t.Fatalf("validateRedemptionBatchLimits(%v, %d) error = %v", test.points, test.quantity, err)
			}
		})
	}
}
