valuesEqual compares a JSON-decoded value with a YAML-decoded expected value, handling cross-type numeric comparison (JSON float64 vs YAML int).
(jsonVal, yamlVal interface{})
| 577 | // valuesEqual compares a JSON-decoded value with a YAML-decoded expected value, |
| 578 | // handling cross-type numeric comparison (JSON float64 vs YAML int). |
| 579 | func valuesEqual(jsonVal, yamlVal interface{}) bool { |
| 580 | switch yv := yamlVal.(type) { |
| 581 | case int: |
| 582 | switch jv := jsonVal.(type) { |
| 583 | case float64: |
| 584 | return jv == float64(yv) |
| 585 | case int: |
| 586 | return jv == yv |
| 587 | } |
| 588 | case bool: |
| 589 | jv, ok := jsonVal.(bool) |
| 590 | return ok && jv == yv |
| 591 | case string: |
| 592 | jv, ok := jsonVal.(string) |
| 593 | return ok && jv == yv |
| 594 | } |
| 595 | return fmt.Sprintf("%v", jsonVal) == fmt.Sprintf("%v", yamlVal) |
| 596 | } |
| 597 | |
| 598 | // extractEmailFromWSPath extracts the agent email from a WS path like |
| 599 | // /v1/agents/bot@ws.test.dev/ws |
no outgoing calls
no test coverage detected