Skip to content

Commit 1fd5b72

Browse files
yyyu-googlecopybara-github
authored andcommitted
fix: correct sys test logic on stream endpoint for funcion calling
PiperOrigin-RevId: 617943619
1 parent 7a366ab commit 1fd5b72

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

system_test/end_to_end_sample_test.ts

+18-16
Original file line numberDiff line numberDiff line change
@@ -414,15 +414,16 @@ describe('generateContentStream', () => {
414414
item
415415
)}`
416416
);
417-
expect(
418-
item.candidates![0].content.parts[0].text?.toLowerCase()
419-
).toContain(
420-
WEATHER_FORECAST,
421-
`sys test failure on generateContentStream for candidate part ${JSON.stringify(
422-
item.candidates![0].content.parts[0]
423-
)}`
424-
);
425417
}
418+
const aggregaratedResponse = await streamingResp.response;
419+
expect(
420+
aggregaratedResponse.candidates![0].content.parts[0].text?.toLowerCase()
421+
).toContain(
422+
WEATHER_FORECAST,
423+
`sys test failure on generateContentStream for candidate part ${JSON.stringify(
424+
aggregaratedResponse.candidates![0].content.parts[0]
425+
)}`
426+
);
426427
});
427428
it('in preview should return a text when passed a FunctionDeclaration or FunctionResponse', async () => {
428429
const request = {
@@ -441,15 +442,16 @@ describe('generateContentStream', () => {
441442
item
442443
)}`
443444
);
444-
expect(
445-
item.candidates![0].content.parts[0].text?.toLowerCase()
446-
).toContain(
447-
WEATHER_FORECAST,
448-
`sys test failure on generateContentStream in preview for candidate part ${JSON.stringify(
449-
item.candidates![0].content.parts[0]
450-
)}`
451-
);
452445
}
446+
const aggregaratedResponse = await streamingResp.response;
447+
expect(
448+
aggregaratedResponse.candidates![0].content.parts[0].text?.toLowerCase()
449+
).toContain(
450+
WEATHER_FORECAST,
451+
`sys test failure on generateContentStream for candidate part ${JSON.stringify(
452+
aggregaratedResponse.candidates![0].content.parts[0]
453+
)}`
454+
);
453455
});
454456
it('should return a FunctionCall when passed a FunctionDeclaration', async () => {
455457
const request = {

0 commit comments

Comments
 (0)