toStatus converts ComponentResultsDisplay to status format (simple pass/fail JSON)
()
| 1262 | |
| 1263 | // toStatus converts ComponentResultsDisplay to status format (simple pass/fail JSON) |
| 1264 | func (d ComponentResultsDisplay) toStatus() ([]byte, error) { |
| 1265 | resultStr := determineStatusFromOverall(d.Result.Overall) |
| 1266 | statusReport := map[string]string{"result": resultStr} |
| 1267 | data, err := json.Marshal(statusReport) |
| 1268 | if err != nil { |
| 1269 | return nil, fmt.Errorf("failed to marshal status report: %w", err) |
| 1270 | } |
| 1271 | return data, nil |
| 1272 | } |
| 1273 | |
| 1274 | // determineStatusFromOverall extracts SUCCESS or FAILURE from overall result string |
| 1275 | func determineStatusFromOverall(overall string) string { |
no test coverage detected