From 4de0e3e0f301f28ad9e08ab06a540668c7c0aef5 Mon Sep 17 00:00:00 2001 From: sumeet patil Date: Tue, 12 Sep 2023 19:33:44 +0530 Subject: [PATCH] fix(cxone): fix test cases (#4564) Co-authored-by: thtri --- pkg/checkmarxone/reporting_test.go | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/pkg/checkmarxone/reporting_test.go b/pkg/checkmarxone/reporting_test.go index 04d30e876..5cf735d09 100644 --- a/pkg/checkmarxone/reporting_test.go +++ b/pkg/checkmarxone/reporting_test.go @@ -75,13 +75,20 @@ func TestCreateJSONReport(t *testing.T) { assert.Equal(t, "Incremental", reportingData.ScanType) lowList := (*reportingData.Findings)[2].LowPerQuery - assert.Equal(t, 2, len(*lowList)) - assert.Equal(t, "Low_Query_Name_1", (*lowList)[0].QueryName) - assert.Equal(t, 0, (*lowList)[0].Audited) - assert.Equal(t, 4, (*lowList)[0].Total) - assert.Equal(t, "Low_Query_Name_2", (*lowList)[1].QueryName) - assert.Equal(t, 5, (*lowList)[1].Audited) - assert.Equal(t, 5, (*lowList)[1].Total) + lowListLen := len(*lowList) + assert.Equal(t, 2, lowListLen) + + for i := 0; i < lowListLen; i++ { + if (*lowList)[i].QueryName == "Low_Query_Name_1" { + assert.Equal(t, 0, (*lowList)[i].Audited) + assert.Equal(t, 4, (*lowList)[i].Total) + } + + if (*lowList)[i].QueryName == "Low_Query_Name_2" { + assert.Equal(t, 5, (*lowList)[i].Audited) + assert.Equal(t, 5, (*lowList)[i].Total) + } + } lowPerQuery = map[string]map[string]int{} submap = map[string]int{}