From 7c4c4762ebc68facbbe768493ccf8ae17ce2bf6a Mon Sep 17 00:00:00 2001 From: Shakker Date: Fri, 8 May 2026 17:08:00 +0100 Subject: [PATCH] test: tighten session fork assertions --- src/auto-reply/reply/session-fork.runtime.test.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/auto-reply/reply/session-fork.runtime.test.ts b/src/auto-reply/reply/session-fork.runtime.test.ts index e67a38a5ca5..1d021ae5e1e 100644 --- a/src/auto-reply/reply/session-fork.runtime.test.ts +++ b/src/auto-reply/reply/session-fork.runtime.test.ts @@ -286,10 +286,12 @@ describe("forkSessionFromParentRuntime", () => { sessionsDir, }); - expect(fork).not.toBeNull(); - expect(fork?.sessionFile).toContain(sessionsDir); - expect(fork?.sessionId).not.toBe(parentSessionId); - const raw = await fs.readFile(fork?.sessionFile ?? "", "utf-8"); + if (fork === null) { + throw new Error("Expected forked session"); + } + expect(fork.sessionFile).toContain(sessionsDir); + expect(fork.sessionId).not.toBe(parentSessionId); + const raw = await fs.readFile(fork.sessionFile, "utf-8"); const forkedEntries = raw .trim() .split(/\r?\n/u) @@ -297,7 +299,7 @@ describe("forkSessionFromParentRuntime", () => { const resolvedParentSessionFile = await fs.realpath(parentSessionFile); expect(forkedEntries[0]).toMatchObject({ type: "session", - id: fork?.sessionId, + id: fork.sessionId, cwd, parentSession: resolvedParentSessionFile, });