Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions src/__tests__/fixture-loader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -844,4 +844,75 @@ describe("validateFixtures", () => {
true,
);
});

it("error: reasoning is not a string", () => {
const fixtures = [makeFixture({ response: { content: "hi", reasoning: 123 } as never })];
const results = validateFixtures(fixtures);
expect(
results.some(
(r) => r.severity === "error" && r.message.includes("reasoning must be a string"),
),
).toBe(true);
});

it("warning: reasoning is empty string", () => {
const fixtures = [makeFixture({ response: { content: "hi", reasoning: "" } })];
const results = validateFixtures(fixtures);
expect(
results.some((r) => r.severity === "warning" && r.message.includes("reasoning is empty")),
).toBe(true);
});

it("error: webSearches is not an array", () => {
const fixtures = [
makeFixture({ response: { content: "hi", webSearches: "not-array" } as never }),
];
const results = validateFixtures(fixtures);
expect(
results.some(
(r) => r.severity === "error" && r.message.includes("webSearches must be an array"),
),
).toBe(true);
});

it("error: webSearches element is not a string", () => {
const fixtures = [
makeFixture({ response: { content: "hi", webSearches: ["valid", 42] } as never }),
];
const results = validateFixtures(fixtures);
expect(
results.some(
(r) => r.severity === "error" && r.message.includes("webSearches[1] is not a string"),
),
).toBe(true);
});

it("accepts valid reasoning and webSearches", () => {
const fixtures = [
makeFixture({
response: { content: "hi", reasoning: "thinking...", webSearches: ["query1", "query2"] },
}),
];
expect(validateFixtures(fixtures)).toEqual([]);
});

it("warning: webSearches is empty array", () => {
const fixtures = [makeFixture({ response: { content: "hi", webSearches: [] } })];
const results = validateFixtures(fixtures);
expect(
results.some(
(r) => r.severity === "warning" && r.message.includes("webSearches is empty array"),
),
).toBe(true);
});

it("warning: webSearches element is empty string", () => {
const fixtures = [makeFixture({ response: { content: "hi", webSearches: ["valid", ""] } })];
const results = validateFixtures(fixtures);
expect(
results.some(
(r) => r.severity === "warning" && r.message.includes("webSearches[1] is empty string"),
),
).toBe(true);
});
});
Loading
Loading