Files
kubescape/core/pkg/containerscan/datastructures_test.go
VaibhavMalik4187 55162829e7 Added Test Suite for core/pkg package
Added unit tests for the following files:
- containerscan/datastructures.go
- hostsensorutils/hostsensordeploy.go
- hostsensorutils/hostsensorworkerpool.go
- hostsensorutils/utils.go
- policyhandler/handlepullpolicies.go
- policyhandler/handlepullpoliciesutils.go
- resourcehandler/filesloader.go
- resourcehandler/remotegitutils.go

Signed-off-by: VaibhavMalik4187 <vaibhavmalik2018@gmail.com>
2023-11-23 14:19:13 +05:30

63 lines
919 B
Go

package containerscan
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestCalculateFixed_All(t *testing.T) {
tests := []struct {
Fixes []FixedIn
want int
}{
{
Fixes: []FixedIn{
{Version: "None"},
{Version: ""},
{Version: "1.0.0"},
},
want: 1,
},
{
Fixes: []FixedIn{
{Version: "None"},
{Version: ""},
{Version: ""},
},
want: 0,
},
{
Fixes: []FixedIn{
{Version: "None"},
{Version: ""},
{Version: "None"},
},
want: 0,
},
{
Fixes: []FixedIn{
{Version: "None"},
{Version: ""},
{Version: "1.0.0"},
{Version: "2.0.0"},
},
want: 1,
},
{
Fixes: []FixedIn{
{Version: "None"},
{Version: ""},
{Version: "1.0.0"},
{Version: ""},
},
want: 1,
},
}
for _, tt := range tests {
t.Run("", func(t *testing.T) {
assert.Equal(t, tt.want, CalculateFixed(tt.Fixes))
})
}
}