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