Address feedback

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
This commit is contained in:
Julien Pivotto 2025-04-07 12:58:34 +02:00
parent 2cf2bf5b8f
commit e57512acfc

View File

@ -104,7 +104,7 @@ func TestCalculateDuration(t *testing.T) {
expr parser.Expr
expected time.Duration
errorMessage string
requirePositive bool
allowedNegative bool
}{
{
name: "addition",
@ -193,7 +193,7 @@ func TestCalculateDuration(t *testing.T) {
Op: parser.SUB,
},
expected: -5 * time.Second,
requirePositive: true,
allowedNegative: true,
},
{
name: "division by zero",
@ -225,7 +225,7 @@ func TestCalculateDuration(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result, err := calculateDuration(tt.expr, tt.requirePositive)
result, err := calculateDuration(tt.expr, tt.allowedNegative)
if tt.errorMessage != "" {
require.Error(t, err)
require.Contains(t, err.Error(), tt.errorMessage)