From c92d3f908fbdf1d02499b627f1f0aae24fe1db28 Mon Sep 17 00:00:00 2001 From: Affaan Mustafa Date: Fri, 13 Feb 2026 04:39:25 -0800 Subject: [PATCH] test: verify getSessionById excludes content/metadata/stats when includeContent is false --- tests/lib/session-manager.test.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/lib/session-manager.test.js b/tests/lib/session-manager.test.js index 56bbe32c..34d4b54d 100644 --- a/tests/lib/session-manager.test.js +++ b/tests/lib/session-manager.test.js @@ -938,6 +938,24 @@ src/main.ts assert.strictEqual(meta.completed.length, 1); })) passed++; else failed++; + // ── Round 43: getSessionById default excludes content ── + console.log('\nRound 43: getSessionById (default excludes content):'); + + if (test('getSessionById without includeContent omits content, metadata, and stats', () => { + // Default call (includeContent=false) should NOT load file content + const result = sessionManager.getSessionById('abcd1234'); + assert.ok(result, 'Should find the session'); + assert.strictEqual(result.shortId, 'abcd1234'); + // These fields should be absent when includeContent is false + assert.strictEqual(result.content, undefined, 'content should be undefined'); + assert.strictEqual(result.metadata, undefined, 'metadata should be undefined'); + assert.strictEqual(result.stats, undefined, 'stats should be undefined'); + // Basic fields should still be present + assert.ok(result.sessionPath, 'sessionPath should be present'); + assert.ok(result.size !== undefined, 'size should be present'); + assert.ok(result.modifiedTime, 'modifiedTime should be present'); + })) passed++; else failed++; + // Cleanup — restore both HOME and USERPROFILE (Windows) process.env.HOME = origHome; if (origUserProfile !== undefined) {