test(gateway): use lightweight clears for openai http agent fences

This commit is contained in:
Peter Steinberger
2026-02-22 07:49:57 +00:00
parent d624aa5ab2
commit 682e42b0a1

View File

@@ -95,7 +95,7 @@ describe("OpenAI-compatible HTTP API (e2e)", () => {
it("handles request validation and routing", async () => { it("handles request validation and routing", async () => {
const port = enabledPort; const port = enabledPort;
const mockAgentOnce = (payloads: Array<{ text: string }>) => { const mockAgentOnce = (payloads: Array<{ text: string }>) => {
agentCommand.mockReset(); agentCommand.mockClear();
agentCommand.mockResolvedValueOnce({ payloads } as never); agentCommand.mockResolvedValueOnce({ payloads } as never);
}; };
const expectAgentSessionKeyMatch = async (request: { const expectAgentSessionKeyMatch = async (request: {
@@ -397,7 +397,7 @@ describe("OpenAI-compatible HTTP API (e2e)", () => {
const port = enabledPort; const port = enabledPort;
try { try {
{ {
agentCommand.mockReset(); agentCommand.mockClear();
agentCommand.mockImplementationOnce((async (opts: unknown) => agentCommand.mockImplementationOnce((async (opts: unknown) =>
buildAssistantDeltaResult({ buildAssistantDeltaResult({
opts, opts,
@@ -431,7 +431,7 @@ describe("OpenAI-compatible HTTP API (e2e)", () => {
} }
{ {
agentCommand.mockReset(); agentCommand.mockClear();
agentCommand.mockImplementationOnce((async (opts: unknown) => agentCommand.mockImplementationOnce((async (opts: unknown) =>
buildAssistantDeltaResult({ buildAssistantDeltaResult({
opts, opts,
@@ -460,7 +460,7 @@ describe("OpenAI-compatible HTTP API (e2e)", () => {
} }
{ {
agentCommand.mockReset(); agentCommand.mockClear();
agentCommand.mockResolvedValueOnce({ agentCommand.mockResolvedValueOnce({
payloads: [{ text: "hello" }], payloads: [{ text: "hello" }],
} as never); } as never);