Skip to content

Commit 98deae8

Browse files
committed
Fix tests
1 parent 37b5d7f commit 98deae8

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

cmd/scan_test.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ import (
1616
func TestScan_prepareCustomParams(t *testing.T) {
1717
type args struct {
1818
key string
19-
custom client.Custom
19+
custom *client.Custom
2020
parsedValue interface{}
2121
}
2222
tests := []struct {
2323
name string
2424
args args
25-
want client.Custom
25+
want *client.Custom
2626
}{
2727
{
2828
name: "valid - path with one dot",
2929
args: args{
3030
key: "ruleset_options.exclude",
31-
custom: client.Custom{
31+
custom: &client.Custom{
3232
Params: map[string]interface{}{
3333
"ruleset_options": map[string]interface{}{
3434
"ruleset": "gosec",
@@ -37,7 +37,7 @@ func TestScan_prepareCustomParams(t *testing.T) {
3737
},
3838
parsedValue: "vendor",
3939
},
40-
want: client.Custom{
40+
want: &client.Custom{
4141
Params: map[string]interface{}{
4242
"ruleset_options": map[string]interface{}{
4343
"ruleset": "gosec",
@@ -50,7 +50,7 @@ func TestScan_prepareCustomParams(t *testing.T) {
5050
name: "valid - path without dot",
5151
args: args{
5252
key: "ruleset_type",
53-
custom: client.Custom{
53+
custom: &client.Custom{
5454
Params: map[string]interface{}{
5555
"ruleset_options": map[string]interface{}{
5656
"ruleset": "gosec",
@@ -59,7 +59,7 @@ func TestScan_prepareCustomParams(t *testing.T) {
5959
},
6060
parsedValue: 0,
6161
},
62-
want: client.Custom{
62+
want: &client.Custom{
6363
Params: map[string]interface{}{
6464
"ruleset_type": 0,
6565
"ruleset_options": map[string]interface{}{
@@ -72,7 +72,7 @@ func TestScan_prepareCustomParams(t *testing.T) {
7272
name: "valid - path with two dot",
7373
args: args{
7474
key: "image.image_detail.hash",
75-
custom: client.Custom{
75+
custom: &client.Custom{
7676
Params: map[string]interface{}{
7777
"sha": 1234,
7878
"image": map[string]interface{}{
@@ -82,7 +82,7 @@ func TestScan_prepareCustomParams(t *testing.T) {
8282
},
8383
parsedValue: "12345890",
8484
},
85-
want: client.Custom{
85+
want: &client.Custom{
8686
Params: map[string]interface{}{
8787
"sha": 1234,
8888
"image": map[string]interface{}{
@@ -97,7 +97,11 @@ func TestScan_prepareCustomParams(t *testing.T) {
9797
}
9898
for _, tt := range tests {
9999
t.Run(tt.name, func(t *testing.T) {
100-
got := appendKeyToParamsMap(tt.args.key, tt.args.custom, tt.args.parsedValue)
100+
got, err := appendKeyToParamsMap(tt.args.key, tt.args.custom, tt.args.parsedValue)
101+
if err != nil {
102+
t.Errorf("Scan.prepareCustomParams() error = %v", err)
103+
}
104+
101105
if !reflect.DeepEqual(got, tt.want) {
102106
t.Errorf("Scan.prepareCustomParams() = %v, want %v", got, tt.want)
103107
}

0 commit comments

Comments
 (0)