mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-09-01 17:10:24 +08:00
fix: return empty string for valid result with no issues in formatValidationFeedback
This commit is contained in:
@@ -16,6 +16,11 @@ import type { ValidationResult } from "./validation-schema"
|
||||
* @returns Formatted string for tool error output
|
||||
*/
|
||||
export function formatValidationFeedback(result: ValidationResult): string {
|
||||
// If validation passed with no issues, return empty string
|
||||
if (result.valid && result.issues.length === 0) {
|
||||
return ""
|
||||
}
|
||||
|
||||
const lines: string[] = []
|
||||
|
||||
lines.push("DIAGRAM VISUAL VALIDATION FAILED")
|
||||
|
||||
@@ -78,7 +78,7 @@ describe("formatValidationFeedback", () => {
|
||||
expect(feedback).toContain("Adjust spacing")
|
||||
})
|
||||
|
||||
it("formats result with no issues", () => {
|
||||
it("returns empty string for valid result with no issues", () => {
|
||||
const result: ValidationResult = {
|
||||
valid: true,
|
||||
issues: [],
|
||||
@@ -87,10 +87,7 @@ describe("formatValidationFeedback", () => {
|
||||
|
||||
const feedback = formatValidationFeedback(result)
|
||||
|
||||
expect(feedback).toContain("DIAGRAM VISUAL VALIDATION FAILED")
|
||||
expect(feedback).not.toContain("Critical Issues")
|
||||
expect(feedback).not.toContain("Warnings:")
|
||||
expect(feedback).not.toContain("Suggestions to fix:")
|
||||
expect(feedback).toBe("")
|
||||
})
|
||||
|
||||
it("formats result with multiple suggestions", () => {
|
||||
|
||||
Reference in New Issue
Block a user