Skip to content

Commit 818b141

Browse files
committed
test: cover tool_call_id fallback branch in google adapter
1 parent 28cbb68 commit 818b141

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

packages/backend/src/routing/proxy/__tests__/google-adapter.spec.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,28 @@ describe('Google Adapter', () => {
170170
});
171171
});
172172

173+
it('uses unknown as fallback name when tool_call_id is missing', () => {
174+
const body = {
175+
messages: [
176+
{ role: 'user', content: 'Do something' },
177+
{
178+
role: 'tool',
179+
content: '{"ok": true}',
180+
},
181+
],
182+
};
183+
const result = toGoogleRequest(body, 'gemini-2.0-flash');
184+
185+
const contents = result.contents as Array<{
186+
role: string;
187+
parts: Array<Record<string, unknown>>;
188+
}>;
189+
expect(contents[1].parts[0].functionResponse).toEqual({
190+
name: 'unknown',
191+
response: { result: '{"ok": true}' },
192+
});
193+
});
194+
173195
it('skips messages that produce no parts', () => {
174196
const body = {
175197
messages: [

0 commit comments

Comments
 (0)