test(gateway): dedupe agent payload and stream fixtures

This commit is contained in:
Peter Steinberger
2026-02-19 09:21:41 +00:00
parent b96419fab9
commit 947e11c33a
6 changed files with 53 additions and 45 deletions

View File

@@ -4,6 +4,7 @@ import os from "node:os";
import path from "node:path";
import { describe, expect, it } from "vitest";
import { startGatewayServer } from "./server.js";
import { extractPayloadText } from "./test-helpers.agent-results.js";
import {
connectDeviceAuthReq,
connectGatewayClient,
@@ -13,15 +14,6 @@ import {
import { installOpenAiResponsesMock } from "./test-helpers.openai-mock.js";
import { buildOpenAiResponsesProviderConfig } from "./test-openai-responses-model.js";
function extractPayloadText(result: unknown): string {
const record = result as Record<string, unknown>;
const payloads = Array.isArray(record.payloads) ? record.payloads : [];
const texts = payloads
.map((p) => (p && typeof p === "object" ? (p as Record<string, unknown>).text : undefined))
.filter((t): t is string => typeof t === "string" && t.trim().length > 0);
return texts.join("\n").trim();
}
describe("gateway e2e", () => {
it(
"runs a mock OpenAI tool call end-to-end via gateway agent loop",