(expected, actual string, jsonNoiseKeys map[string]struct{})
| 1625 | } |
| 1626 | |
| 1627 | func compareJSONTextWithNoise(expected, actual string, jsonNoiseKeys map[string]struct{}) (bool, error) { |
| 1628 | var exp any |
| 1629 | var act any |
| 1630 | |
| 1631 | if err := json.Unmarshal([]byte(expected), &exp); err != nil { |
| 1632 | return false, err |
| 1633 | } |
| 1634 | if err := json.Unmarshal([]byte(actual), &act); err != nil { |
| 1635 | return false, err |
| 1636 | } |
| 1637 | |
| 1638 | exp = removeGlobalNoiseKeys(exp, jsonNoiseKeys) |
| 1639 | act = removeGlobalNoiseKeys(act, jsonNoiseKeys) |
| 1640 | |
| 1641 | return reflect.DeepEqual(exp, act), nil |
| 1642 | } |
| 1643 | |
| 1644 | func removeGlobalNoiseKeys(node any, jsonNoiseKeys map[string]struct{}) any { |
| 1645 | switch v := node.(type) { |
no test coverage detected