generated from coulomb/repo-seed
Add Markitect check fixtures
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
@@ -413,15 +412,21 @@ func expectationMatches(expected, actual api.DecisionExpectation) bool {
|
||||
if expected.Reason != "" && expected.Reason != actual.Reason {
|
||||
return false
|
||||
}
|
||||
if len(expected.Obligations) > 0 && !reflect.DeepEqual(expected.Obligations, actual.Obligations) {
|
||||
if len(expected.Obligations) > 0 && !jsonEqual(expected.Obligations, actual.Obligations) {
|
||||
return false
|
||||
}
|
||||
if len(expected.ConformanceFindings) > 0 && !reflect.DeepEqual(expected.ConformanceFindings, actual.ConformanceFindings) {
|
||||
if len(expected.ConformanceFindings) > 0 && !jsonEqual(expected.ConformanceFindings, actual.ConformanceFindings) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func jsonEqual(left, right any) bool {
|
||||
leftData, leftErr := json.Marshal(left)
|
||||
rightData, rightErr := json.Marshal(right)
|
||||
return leftErr == nil && rightErr == nil && string(leftData) == string(rightData)
|
||||
}
|
||||
|
||||
func toRegoInput(value any) (map[string]any, error) {
|
||||
data, err := json.Marshal(value)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user