mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-04 06:34:06 +00:00
fix(e2e): require expected web search rejection
This commit is contained in:
31
test/scripts/openai-web-search-minimal-client.test.ts
Normal file
31
test/scripts/openai-web-search-minimal-client.test.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { testing } from "../../scripts/e2e/lib/openai-web-search-minimal/client.mjs";
|
||||
|
||||
describe("scripts/e2e/lib/openai-web-search-minimal/client.mjs", () => {
|
||||
it("accepts only the expected raw schema rejection in reject mode", () => {
|
||||
expect(
|
||||
testing.validateRejectResult({
|
||||
ok: false,
|
||||
error: new Error(`gateway failed: ${testing.DEFAULT_RAW_SCHEMA_ERROR}`),
|
||||
}),
|
||||
).toContain(testing.DEFAULT_RAW_SCHEMA_ERROR);
|
||||
});
|
||||
|
||||
it("fails reject mode when the agent run unexpectedly succeeds", () => {
|
||||
expect(() =>
|
||||
testing.validateRejectResult({
|
||||
ok: true,
|
||||
value: { status: "ok" },
|
||||
}),
|
||||
).toThrow(/reject mode unexpectedly completed/u);
|
||||
});
|
||||
|
||||
it("fails reject mode on unrelated transport errors", () => {
|
||||
expect(() =>
|
||||
testing.validateRejectResult({
|
||||
ok: false,
|
||||
error: new Error("connect ECONNREFUSED 127.0.0.1:9"),
|
||||
}),
|
||||
).toThrow(/reject mode failed for an unexpected reason/u);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user