Skip to content

Commit 8eece14

Browse files
committed
Fix an eslint error
1 parent 93dc6c2 commit 8eece14

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

ansible_ai_connect_chatbot/src/App.test.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,16 @@ function mockFetchEventSource() {
252252

253253
const ok = status === 200;
254254
await init.onopen({ status, ok });
255+
255256
if (status === 200) {
256-
const streamData = agent
257-
? streamAgentNormalData
258-
: errorCase
259-
? streamErrorData
260-
: streamNormalData;
261-
for (const data of streamData) {
257+
const streamData = () => {
258+
if (agent) {
259+
return streamAgentNormalData;
260+
} else {
261+
return errorCase ? streamErrorData : streamNormalData;
262+
}
263+
};
264+
for (const data of streamData()) {
262265
init.onmessage({ data: JSON.stringify(data) });
263266
}
264267
}

0 commit comments

Comments
 (0)