mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:10:43 +00:00
fix(gateway): scope reset hook assertion
This commit is contained in:
@@ -2930,10 +2930,25 @@ describe("gateway server sessions", () => {
|
||||
reason: "new",
|
||||
});
|
||||
expect(reset.ok).toBe(true);
|
||||
expect(sessionHookMocks.triggerInternalHook).toHaveBeenCalledTimes(1);
|
||||
const event = (
|
||||
const resetHookEvents = (
|
||||
sessionHookMocks.triggerInternalHook.mock.calls as unknown as Array<[unknown]>
|
||||
)[0]?.[0] as { context?: { previousSessionEntry?: unknown } } | undefined;
|
||||
)
|
||||
.map((call) => call[0])
|
||||
.filter(
|
||||
(
|
||||
event,
|
||||
): event is {
|
||||
type: string;
|
||||
action: string;
|
||||
context?: { previousSessionEntry?: unknown };
|
||||
} =>
|
||||
Boolean(event) &&
|
||||
typeof event === "object" &&
|
||||
(event as { type?: unknown }).type === "command" &&
|
||||
(event as { action?: unknown }).action === "new",
|
||||
);
|
||||
expect(resetHookEvents).toHaveLength(1);
|
||||
const event = resetHookEvents[0];
|
||||
if (!event) {
|
||||
throw new Error("expected session hook event");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user