test: fix plugin stream typing assertions

This commit is contained in:
Peter Steinberger
2026-04-05 11:58:02 +09:00
parent 6596e64a68
commit 1811e54920
2 changed files with 9 additions and 4 deletions

View File

@@ -85,7 +85,9 @@ describe("openrouter provider hooks", () => {
);
expect(baseStreamFn).toHaveBeenCalledOnce();
expect(baseStreamFn.mock.calls[0]?.[0]).toMatchObject({
const firstCall = baseStreamFn.mock.calls[0];
const firstModel = firstCall?.[0];
expect(firstModel).toMatchObject({
compat: {
openRouterRouting: {
order: ["moonshot"],

View File

@@ -10,7 +10,10 @@ import {
type ToolPayload = {
function?: Record<string, unknown>;
};
type XaiTestPayload = Record<string, unknown> & {
tools?: Array<{ type?: string; function?: Record<string, unknown> }>;
input?: unknown[];
};
function captureWrappedModelId(params: {
modelId: string;
fastMode: boolean;
@@ -63,10 +66,10 @@ describe("xai stream wrappers", () => {
it("composes the xai provider stream chain from extra params", () => {
let capturedModelId = "";
let capturedPayload: Record<string, unknown> | undefined;
let capturedPayload: XaiTestPayload | undefined;
const baseStreamFn: StreamFn = (model, _context, options) => {
capturedModelId = String(model.id);
const payload: Record<string, unknown> = {
const payload: XaiTestPayload = {
reasoning: { effort: "high" },
tools: [
{