Skip to content

Commit ac27852

Browse files
committed
fix: update AI test generator service to enforce valid JSON output and clean up logging
1 parent 73c27aa commit ac27852

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

backend/src/lib/prisma.ts

Whitespace-only changes.

backend/src/services/ai-test-generator.service.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Each test case object in the array MUST have the following exact fields:
2222
- "headers": an object for HTTP headers (e.g., { "Content-Type": "application/json" }) or null
2323
- "body": an object for the request body or null
2424
- "expected_response_code": an integer for the expected HTTP status code (e.g., 200, 400, 201)
25+
Respond with only valid JSON array output. Do not include explanations, code blocks, or markdown.
2526
`;
2627

2728
const dataContext = `
@@ -70,8 +71,7 @@ JSON Response:
7071
throw new Error("AI response is not a JSON array");
7172
}
7273
logger.info(
73-
`Successfully generated ${
74-
testCases.length
74+
`Successfully generated ${testCases.length
7575
} test cases for ${method.toUpperCase()} ${path}`
7676
);
7777
} catch (error: unknown) {
@@ -80,11 +80,11 @@ JSON Response:
8080

8181
logger.error(
8282
"AI test generation failed" +
83-
{
84-
error: message,
85-
method,
86-
path,
87-
}
83+
{
84+
error: message,
85+
method,
86+
path,
87+
}
8888
);
8989

9090
console.error(error);

frontend/src/main.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { StrictMode } from 'react'
1+
// import { StrictMode } from 'react'
22
import { createRoot } from 'react-dom/client'
33
import './index.css'
44
import App from './App.tsx'
55
createRoot(document.getElementById('root')!).render(
6-
<StrictMode>
7-
<App />
8-
</StrictMode>,
6+
// <StrictMode>
7+
<App />
98
)

0 commit comments

Comments
 (0)