mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 12:31:23 +00:00
chore: Fix types in tests 11/N.
This commit is contained in:
@@ -77,7 +77,7 @@ describe("gateway server hooks", () => {
|
||||
});
|
||||
expect(resAgentModel.status).toBe(202);
|
||||
await waitForSystemEvent();
|
||||
const call = cronIsolatedRun.mock.calls[0]?.[0] as {
|
||||
const call = (cronIsolatedRun.mock.calls[0] as unknown[] | undefined)?.[0] as {
|
||||
job?: { payload?: { model?: string } };
|
||||
};
|
||||
expect(call?.job?.payload?.model).toBe("openai/gpt-4.1-mini");
|
||||
@@ -98,7 +98,7 @@ describe("gateway server hooks", () => {
|
||||
});
|
||||
expect(resAgentWithId.status).toBe(202);
|
||||
await waitForSystemEvent();
|
||||
const routedCall = cronIsolatedRun.mock.calls[0]?.[0] as {
|
||||
const routedCall = (cronIsolatedRun.mock.calls[0] as unknown[] | undefined)?.[0] as {
|
||||
job?: { agentId?: string };
|
||||
};
|
||||
expect(routedCall?.job?.agentId).toBe("hooks");
|
||||
@@ -119,7 +119,7 @@ describe("gateway server hooks", () => {
|
||||
});
|
||||
expect(resAgentUnknown.status).toBe(202);
|
||||
await waitForSystemEvent();
|
||||
const fallbackCall = cronIsolatedRun.mock.calls[0]?.[0] as {
|
||||
const fallbackCall = (cronIsolatedRun.mock.calls[0] as unknown[] | undefined)?.[0] as {
|
||||
job?: { agentId?: string };
|
||||
};
|
||||
expect(fallbackCall?.job?.agentId).toBe("main");
|
||||
@@ -250,7 +250,9 @@ describe("gateway server hooks", () => {
|
||||
});
|
||||
expect(defaultRoute.status).toBe(202);
|
||||
await waitForSystemEvent();
|
||||
const defaultCall = cronIsolatedRun.mock.calls[0]?.[0] as { sessionKey?: string } | undefined;
|
||||
const defaultCall = (cronIsolatedRun.mock.calls[0] as unknown[] | undefined)?.[0] as
|
||||
| { sessionKey?: string }
|
||||
| undefined;
|
||||
expect(defaultCall?.sessionKey).toBe("hook:ingress");
|
||||
drainSystemEvents(resolveMainKey());
|
||||
|
||||
@@ -266,7 +268,9 @@ describe("gateway server hooks", () => {
|
||||
});
|
||||
expect(mappedOk.status).toBe(202);
|
||||
await waitForSystemEvent();
|
||||
const mappedCall = cronIsolatedRun.mock.calls[0]?.[0] as { sessionKey?: string } | undefined;
|
||||
const mappedCall = (cronIsolatedRun.mock.calls[0] as unknown[] | undefined)?.[0] as
|
||||
| { sessionKey?: string }
|
||||
| undefined;
|
||||
expect(mappedCall?.sessionKey).toBe("hook:mapped:42");
|
||||
drainSystemEvents(resolveMainKey());
|
||||
|
||||
@@ -328,7 +332,7 @@ describe("gateway server hooks", () => {
|
||||
});
|
||||
expect(resNoAgent.status).toBe(202);
|
||||
await waitForSystemEvent();
|
||||
const noAgentCall = cronIsolatedRun.mock.calls[0]?.[0] as {
|
||||
const noAgentCall = (cronIsolatedRun.mock.calls[0] as unknown[] | undefined)?.[0] as {
|
||||
job?: { agentId?: string };
|
||||
};
|
||||
expect(noAgentCall?.job?.agentId).toBeUndefined();
|
||||
@@ -349,7 +353,7 @@ describe("gateway server hooks", () => {
|
||||
});
|
||||
expect(resAllowed.status).toBe(202);
|
||||
await waitForSystemEvent();
|
||||
const allowedCall = cronIsolatedRun.mock.calls[0]?.[0] as {
|
||||
const allowedCall = (cronIsolatedRun.mock.calls[0] as unknown[] | undefined)?.[0] as {
|
||||
job?: { agentId?: string };
|
||||
};
|
||||
expect(allowedCall?.job?.agentId).toBe("hooks");
|
||||
|
||||
Reference in New Issue
Block a user