test: tighten session fork assertions

This commit is contained in:
Shakker
2026-05-08 17:08:00 +01:00
parent 0bd7995ddb
commit 7c4c4762eb

View File

@@ -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,
});