Fix gbrain config isolation test

This commit is contained in:
Garry Tan
2026-04-25 08:22:11 -07:00
parent d89a6d008c
commit ae5005d818
+6 -4
View File
@@ -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);
});
});