Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

own-key-schema-wire.spec.ts

19 lines743 Bytes

1import { test, expect } from './fixtures'
2​
3/**
4 * A tool schema property named `__proto__` must reach the provider.
5 * `stripUnsupportedFormats`, the last step of the strict schema conversion,
6 * must copy it as an own key.
7 */
8test('a tool schema keeps a property named __proto__', async ({ request }) => {
9 const response = await request.post('/api/own-key-schema-wire')
10 expect(response.ok()).toBe(true)
11 const { body } = await response.json()
12 const parameters = body.tools[0].function.parameters
13 expect(Object.hasOwn(parameters.properties, '__proto__')).toBe(true)
14 expect(Object.keys(parameters.properties)).toEqual([
15 '__proto__',
16 'constructor',
17 ])
18 expect(parameters.required).toEqual(['__proto__', 'constructor'])
19})