From db1c4afcd6512ce44f763db9f44ed50df3722abb Mon Sep 17 00:00:00 2001 From: cbrom Date: Fri, 24 Nov 2023 14:38:48 +0300 Subject: [PATCH] assert instead of if else check on tests Signed-off-by: cbrom --- core/pkg/containerscan/containerscan_test.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/core/pkg/containerscan/containerscan_test.go b/core/pkg/containerscan/containerscan_test.go index 3eaf4324..a1a69d69 100644 --- a/core/pkg/containerscan/containerscan_test.go +++ b/core/pkg/containerscan/containerscan_test.go @@ -144,9 +144,7 @@ func TestValidate(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { res := test.in.Validate() - if test.expected != res { - t.Errorf("wrong validation status: %v", res) - } + assert.Equal(t, test.expected, res) }) } } @@ -194,9 +192,7 @@ func TestCalculateFixed(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { res := CalculateFixed(test.in) - if test.expected != res { - t.Errorf("wrong fix status: %v", res) - } + assert.Equal(t, test.expected, res) }) } }