fix: address cubic re-review — remove non-existent session.stop event, fix env var fallback test
This commit is contained in:
@@ -11,7 +11,7 @@ describe("createOpenClawHook", () => {
|
||||
wakeOpenClawMock.mockClear()
|
||||
})
|
||||
|
||||
test("maps session.stop events to stop", async () => {
|
||||
test("maps session.created to session-start", async () => {
|
||||
const { createOpenClawHook } = await import("./openclaw")
|
||||
const hook = createOpenClawHook(
|
||||
{ directory: "/tmp/project" } as any,
|
||||
@@ -20,14 +20,14 @@ describe("createOpenClawHook", () => {
|
||||
|
||||
await hook?.event?.({
|
||||
event: {
|
||||
type: "session.stop",
|
||||
type: "session.created",
|
||||
properties: { sessionID: "session-1" },
|
||||
},
|
||||
})
|
||||
|
||||
expect(wakeOpenClawMock).toHaveBeenCalledWith(
|
||||
expect.anything(),
|
||||
"stop",
|
||||
"session-start",
|
||||
expect.objectContaining({
|
||||
projectPath: "/tmp/project",
|
||||
sessionId: "session-1",
|
||||
|
||||
@@ -34,8 +34,6 @@ export function createOpenClawHook(
|
||||
// This is heuristic. If the last message was from assistant and ended with a question?
|
||||
// Or if the system is idle.
|
||||
await handleWake("session-idle", context)
|
||||
} else if (event.type === "session.stop") {
|
||||
await handleWake("stop", context)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -60,7 +60,8 @@ describe("OpenClaw Dispatcher", () => {
|
||||
process.env.OMO_OPENCLAW_COMMAND_TIMEOUT_MS = "4321"
|
||||
|
||||
try {
|
||||
expect(resolveCommandTimeoutMs(undefined, process.env.OMO_OPENCLAW_COMMAND_TIMEOUT_MS)).toBe(4321)
|
||||
// Call without explicit envTimeoutRaw so the function reads from process.env itself
|
||||
expect(resolveCommandTimeoutMs(undefined)).toBe(4321)
|
||||
} finally {
|
||||
if (original === undefined) delete process.env.OMO_OPENCLAW_COMMAND_TIMEOUT_MS
|
||||
else process.env.OMO_OPENCLAW_COMMAND_TIMEOUT_MS = original
|
||||
|
||||
Reference in New Issue
Block a user