From ae5005d8181cf2d1e267bd933467d6185d83f2a8 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Sat, 25 Apr 2026 08:22:11 -0700 Subject: [PATCH] Fix gbrain config isolation test --- test/brain-sync.test.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/brain-sync.test.ts b/test/brain-sync.test.ts index 6ba8e95c..178fe21f 100644 --- a/test/brain-sync.test.ts +++ b/test/brain-sync.test.ts @@ -97,11 +97,13 @@ describe('gstack-config gbrain keys', () => { }); test('GSTACK_HOME overrides real config dir', () => { - run(['gstack-config', 'set', 'gbrain_sync_mode', 'full']); - // Real ~/.gstack/config.yaml must NOT have been touched. + // Real ~/.gstack/config.yaml must not change, regardless of what it + // already contains on the developer's machine. const realConfig = path.join(os.homedir(), '.gstack', 'config.yaml'); - const real = fs.existsSync(realConfig) ? fs.readFileSync(realConfig, 'utf-8') : ''; - expect(real).not.toContain('gbrain_sync_mode: full'); + const before = fs.existsSync(realConfig) ? fs.readFileSync(realConfig, 'utf-8') : null; + run(['gstack-config', 'set', 'gbrain_sync_mode', 'full']); + const after = fs.existsSync(realConfig) ? fs.readFileSync(realConfig, 'utf-8') : null; + expect(after).toBe(before); }); });