mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-21 16:41:56 +00:00
test(gateway): use lightweight clears for openresponses agent fences
This commit is contained in:
@@ -124,7 +124,7 @@ describe("OpenResponses HTTP API (e2e)", () => {
|
||||
it("handles OpenResponses request parsing and validation", async () => {
|
||||
const port = enabledPort;
|
||||
const mockAgentOnce = (payloads: Array<{ text: string }>, meta?: unknown) => {
|
||||
agentCommand.mockReset();
|
||||
agentCommand.mockClear();
|
||||
agentCommand.mockResolvedValueOnce({ payloads, meta } as never);
|
||||
};
|
||||
|
||||
@@ -433,7 +433,7 @@ describe("OpenResponses HTTP API (e2e)", () => {
|
||||
it("streams OpenResponses SSE events", async () => {
|
||||
const port = enabledPort;
|
||||
try {
|
||||
agentCommand.mockReset();
|
||||
agentCommand.mockClear();
|
||||
agentCommand.mockImplementationOnce((async (opts: unknown) =>
|
||||
buildAssistantDeltaResult({
|
||||
opts,
|
||||
@@ -473,7 +473,7 @@ describe("OpenResponses HTTP API (e2e)", () => {
|
||||
.join("");
|
||||
expect(deltas).toBe("hello");
|
||||
|
||||
agentCommand.mockReset();
|
||||
agentCommand.mockClear();
|
||||
agentCommand.mockResolvedValueOnce({
|
||||
payloads: [{ text: "hello" }],
|
||||
} as never);
|
||||
@@ -488,7 +488,7 @@ describe("OpenResponses HTTP API (e2e)", () => {
|
||||
expect(fallbackText).toContain("[DONE]");
|
||||
expect(fallbackText).toContain("hello");
|
||||
|
||||
agentCommand.mockReset();
|
||||
agentCommand.mockClear();
|
||||
agentCommand.mockResolvedValueOnce({
|
||||
payloads: [{ text: "hello" }],
|
||||
} as never);
|
||||
@@ -516,7 +516,7 @@ describe("OpenResponses HTTP API (e2e)", () => {
|
||||
|
||||
it("blocks unsafe URL-based file/image inputs", async () => {
|
||||
const port = enabledPort;
|
||||
agentCommand.mockReset();
|
||||
agentCommand.mockClear();
|
||||
|
||||
const blockedPrivate = await postResponses(port, {
|
||||
model: "openclaw",
|
||||
@@ -619,7 +619,7 @@ describe("OpenResponses HTTP API (e2e)", () => {
|
||||
const allowlistPort = await getFreePort();
|
||||
const allowlistServer = await startServer(allowlistPort, { openResponsesEnabled: true });
|
||||
try {
|
||||
agentCommand.mockReset();
|
||||
agentCommand.mockClear();
|
||||
|
||||
const allowlistBlocked = await postResponses(allowlistPort, {
|
||||
model: "openclaw",
|
||||
@@ -674,7 +674,7 @@ describe("OpenResponses HTTP API (e2e)", () => {
|
||||
const capPort = await getFreePort();
|
||||
const capServer = await startServer(capPort, { openResponsesEnabled: true });
|
||||
try {
|
||||
agentCommand.mockReset();
|
||||
agentCommand.mockClear();
|
||||
const maxUrlBlocked = await postResponses(capPort, {
|
||||
model: "openclaw",
|
||||
input: [
|
||||
|
||||
Reference in New Issue
Block a user