Skip to content

Commit

Permalink
metadata test
Browse files Browse the repository at this point in the history
  • Loading branch information
cx-RomeuAlves committed Jan 13, 2025
1 parent 86d26e6 commit 8b629a3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions internal/app/metadata/metadata_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package metadata

import (
"sort"
"testing"

"github.com/checkmarxDev/ast-sast-export/internal/app/interfaces"
Expand Down Expand Up @@ -148,5 +149,19 @@ func TestMetadataFactory_GetMetadataForQueryAndResult(t *testing.T) {
},
},
}

sortRecordPaths(expectedResult)
sortRecordPaths(result)

assert.Equal(t, expectedResult, result)
}

func sortRecordPaths(record *Record) {
for _, query := range record.Queries {
for _, result := range query.Results {
sort.Slice(result.Paths, func(i, j int) bool {
return result.Paths[i].PathID < result.Paths[j].PathID
})
}
}
}

0 comments on commit 8b629a3

Please sign in to comment.