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

anthropic-computer-use-wire.spec.ts

28 lines891 Bytes

1import { test, expect } from './fixtures'
2​
3/**
4 * Wire format of Anthropic computer use. `computerUseTool()` is a beta tool,
5 * so the request must carry its `anthropic-beta` header.
6 *
7 * `/api/anthropic-computer-use-wire` captures the outgoing request with a
8 * custom `fetch` and returns its `anthropic-beta` header as JSON.
9 */
10test.describe('anthropic — computer use wire format', () => {
11 test('computer_20250124 sends the computer-use-2025-01-24 beta', async ({
12 request,
13 }) => {
14 const res = await request.post('/api/anthropic-computer-use-wire')
15 expect(res.ok()).toBe(true)
16 const { ok, error, anthropicBeta } = (await res.json()) as {
17 ok: boolean
18 error?: string
19 anthropicBeta: string | null
20 }
21​
22 if (!ok) {
23 throw new Error(`Route failed: ${error}`)
24 }
25​
26 expect(anthropicBeta ?? '').toContain('computer-use-2025-01-24')
27 })
28})