Skip to content

Commit 35fd196

Browse files
committed
simplify tests
1 parent c3b12bd commit 35fd196

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

tests/custom.test.ts

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import { computerTool, bashTool, editTool } from "../src/tools";
1515
import { z } from "zod";
1616
import assert from "assert";
1717

18-
const YCStats = z.object({
19-
number_of_startups: z.number(),
20-
combined_valuation: z.number(),
18+
const ExampleSite = z.object({
19+
title: z.string(),
20+
has_links: z.boolean(),
2121
});
2222

2323
describe("test", () => {
@@ -49,16 +49,16 @@ describe("test", () => {
4949
const response = await client.act({
5050
model: anthropic(),
5151
system: ANTHROPIC_UBUNTU_SYSTEM_PROMPT,
52-
prompt: "Go to the YC website and get the number of funded startups and combined valuation",
52+
prompt: "Go to example.com and get the page title and whether it has any links",
5353
tools: [computerTool(ubuntuInstance), bashTool(ubuntuInstance), editTool(ubuntuInstance)],
54-
schema: YCStats,
54+
schema: ExampleSite,
5555
onStep: (step) => console.log(step.text, step.toolCalls),
5656
});
5757
console.log(response.output);
5858

5959
assert(response.output !== undefined);
60-
assert(response.output.number_of_startups !== undefined);
61-
assert(response.output.combined_valuation !== undefined);
60+
assert(response.output.title !== undefined);
61+
assert(typeof response.output.has_links === 'boolean');
6262

6363
await ubuntuInstance.browser.stop();
6464
await ubuntuInstance.stop();
@@ -82,16 +82,16 @@ describe("test", () => {
8282
const response = await client.act({
8383
model: anthropic({ name: "claude-3-7-sonnet-20250219-thinking" }),
8484
system: ANTHROPIC_UBUNTU_SYSTEM_PROMPT,
85-
prompt: "Go to the YC website and get the number of funded startups and combined valuation",
85+
prompt: "Go to example.com and get the page title and whether it has any links",
8686
tools: [computerTool(ubuntuInstance), bashTool(ubuntuInstance), editTool(ubuntuInstance)],
87-
schema: YCStats,
87+
schema: ExampleSite,
8888
onStep: (step) => console.log(step.text, step.toolCalls, step.reasoningParts),
8989
});
9090
console.log(response.output);
9191

9292
assert(response.output !== undefined);
93-
assert(response.output.number_of_startups !== undefined);
94-
assert(response.output.combined_valuation !== undefined);
93+
assert(response.output.title !== undefined);
94+
assert(typeof response.output.has_links === 'boolean');
9595

9696
await ubuntuInstance.browser.stop();
9797
await ubuntuInstance.stop();
@@ -114,16 +114,16 @@ describe("test", () => {
114114
const response = await client.act({
115115
model: anthropic(),
116116
system: ANTHROPIC_BROWSER_SYSTEM_PROMPT,
117-
prompt: "Go to the YC website and get the number of funded startups and combined valuation",
117+
prompt: "Go to example.com and get the page title and whether it has any links",
118118
tools: [computerTool(browserInstance)],
119-
schema: YCStats,
119+
schema: ExampleSite,
120120
onStep: (step) => console.log(step.text, step.toolCalls),
121121
});
122122
console.log(response.output);
123123

124124
assert(response.output !== undefined);
125-
assert(response.output.number_of_startups !== undefined);
126-
assert(response.output.combined_valuation !== undefined);
125+
assert(response.output.title !== undefined);
126+
assert(typeof response.output.has_links === 'boolean');
127127

128128
await browserInstance.stop();
129129
}, 600000);
@@ -145,16 +145,16 @@ describe("test", () => {
145145
const response = await client.act({
146146
model: anthropic({ name: "claude-3-7-sonnet-20250219-thinking" }),
147147
system: ANTHROPIC_BROWSER_SYSTEM_PROMPT,
148-
prompt: "Go to the YC website and get the number of funded startups and combined valuation",
148+
prompt: "Go to example.com and get the page title and whether it has any links",
149149
tools: [computerTool(browserInstance)],
150-
schema: YCStats,
150+
schema: ExampleSite,
151151
onStep: (step) => console.log(step.text, step.toolCalls, step.reasoningParts),
152152
});
153153
console.log(response.output);
154154

155155
assert(response.output !== undefined);
156-
assert(response.output.number_of_startups !== undefined);
157-
assert(response.output.combined_valuation !== undefined);
156+
assert(response.output.title !== undefined);
157+
assert(typeof response.output.has_links === 'boolean');
158158

159159
await browserInstance.stop();
160160
}, 600000);
@@ -173,16 +173,16 @@ describe("test", () => {
173173
const response = await client.act({
174174
model: anthropic(),
175175
system: ANTHROPIC_WINDOWS_SYSTEM_PROMPT,
176-
prompt: "Go to the YC website and get the number of funded startups and combined valuation",
176+
prompt: "Go to example.com and get the page title and whether it has any links",
177177
tools: [computerTool(windowsInstance)],
178-
schema: YCStats,
178+
schema: ExampleSite,
179179
onStep: (step) => console.log(step.text, step.toolCalls),
180180
});
181181
console.log(response.output);
182182

183183
assert(response.output !== undefined);
184-
assert(response.output.number_of_startups !== undefined);
185-
assert(response.output.combined_valuation !== undefined);
184+
assert(response.output.title !== undefined);
185+
assert(typeof response.output.has_links === 'boolean');
186186

187187
await windowsInstance.stop();
188188
}, 600000);
@@ -205,16 +205,16 @@ describe("test", () => {
205205
const response = await client.act({
206206
model: openai(),
207207
system: OPENAI_UBUNTU_SYSTEM_PROMPT,
208-
prompt: "Go to the YC website and get the number of funded startups and combined valuation",
208+
prompt: "Go to example.com and get the page title and whether it has any links",
209209
tools: [computerTool(ubuntuInstance), bashTool(ubuntuInstance), editTool(ubuntuInstance)],
210-
schema: YCStats,
210+
schema: ExampleSite,
211211
onStep: (step) => console.log(step.text, step.toolCalls),
212212
});
213213
console.log(response.output);
214214

215215
assert(response.output !== undefined);
216-
assert(response.output.number_of_startups !== undefined);
217-
assert(response.output.combined_valuation !== undefined);
216+
assert(response.output.title !== undefined);
217+
assert(typeof response.output.has_links === 'boolean');
218218

219219
await ubuntuInstance.browser.stop();
220220
await ubuntuInstance.stop();
@@ -237,16 +237,16 @@ describe("test", () => {
237237
const response = await client.act({
238238
model: openai(),
239239
system: OPENAI_BROWSER_SYSTEM_PROMPT,
240-
prompt: "Go to the YC website and get the number of funded startups and combined valuation",
240+
prompt: "Go to example.com and get the page title and whether it has any links",
241241
tools: [computerTool(browserInstance)],
242-
schema: YCStats,
242+
schema: ExampleSite,
243243
onStep: (step) => console.log(step.text, step.toolCalls),
244244
});
245245
console.log(response.output);
246246

247247
assert(response.output !== undefined);
248-
assert(response.output.number_of_startups !== undefined);
249-
assert(response.output.combined_valuation !== undefined);
248+
assert(response.output.title !== undefined);
249+
assert(typeof response.output.has_links === 'boolean');
250250

251251
await browserInstance.stop();
252252
}, 600000);
@@ -265,16 +265,16 @@ describe("test", () => {
265265
const response = await client.act({
266266
model: openai(),
267267
system: OPENAI_WINDOWS_SYSTEM_PROMPT,
268-
prompt: "Go to the YC website and get the number of funded startups and combined valuation",
268+
prompt: "Go to example.com and get the page title and whether it has any links",
269269
tools: [computerTool(windowsInstance)],
270-
schema: YCStats,
270+
schema: ExampleSite,
271271
onStep: (step) => console.log(step.text, step.toolCalls),
272272
});
273273
console.log(response.output);
274274

275275
assert(response.output !== undefined);
276-
assert(response.output.number_of_startups !== undefined);
277-
assert(response.output.combined_valuation !== undefined);
276+
assert(response.output.title !== undefined);
277+
assert(typeof response.output.has_links === 'boolean');
278278

279279
await windowsInstance.stop();
280280
}, 600000);

0 commit comments

Comments
 (0)