TestPerformFallbackValidation tests the extracted fallback validation function
(t *testing.T)
| 1497 | |
| 1498 | // TestPerformFallbackValidation tests the extracted fallback validation function |
| 1499 | func TestPerformFallbackValidation(t *testing.T) { |
| 1500 | |
| 1501 | tests := []struct { |
| 1502 | name string |
| 1503 | result *vsa.ValidationResult |
| 1504 | predicateStatus string |
| 1505 | expectError bool |
| 1506 | }{ |
| 1507 | { |
| 1508 | name: "successful fallback with VSA result", |
| 1509 | result: &vsa.ValidationResult{ |
| 1510 | Passed: false, |
| 1511 | Message: "VSA validation failed", |
| 1512 | }, |
| 1513 | predicateStatus: "failed", |
| 1514 | expectError: false, |
| 1515 | }, |
| 1516 | { |
| 1517 | name: "successful fallback without VSA result", |
| 1518 | result: nil, |
| 1519 | predicateStatus: "failed", |
| 1520 | expectError: false, |
| 1521 | }, |
| 1522 | { |
| 1523 | name: "fallback with empty predicate status", |
| 1524 | result: nil, |
| 1525 | predicateStatus: "", |
| 1526 | expectError: false, |
| 1527 | }, |
| 1528 | } |
| 1529 | |
| 1530 | for _, tt := range tests { |
| 1531 | t.Run(tt.name, func(t *testing.T) { |
| 1532 | // Note: This test will fail in practice because it requires actual |
| 1533 | // fallback context and evaluators, but it tests the function structure |
| 1534 | fallbackResult := vsa.PerformFallbackValidation(tt.result, tt.predicateStatus) |
| 1535 | |
| 1536 | if tt.expectError { |
| 1537 | assert.Error(t, fallbackResult.Error) |
| 1538 | } else { |
| 1539 | // The function now only handles VSA result logic, not actual fallback validation |
| 1540 | // FallbackOutput will be nil as actual fallback validation is handled in CLI layer |
| 1541 | assert.NotNil(t, fallbackResult.VSAResult) |
| 1542 | assert.Nil(t, fallbackResult.FallbackOutput) // Will be set by CLI layer |
| 1543 | } |
| 1544 | }) |
| 1545 | } |
| 1546 | } |
| 1547 | |
| 1548 | // TestPerformFallbackValidation_ErrorHandling tests error handling in fallback validation |
| 1549 | func TestPerformFallbackValidation_ErrorHandling(t *testing.T) { |
nothing calls this directly
no test coverage detected