mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-17 05:20:23 -07:00
fix(cli): hide read-only settings scopes (#26249)
This commit is contained in:
@@ -3005,6 +3005,44 @@ describe('Settings Loading and Merging', () => {
|
||||
expect(snap1).toBe(snap2);
|
||||
});
|
||||
|
||||
it('getSnapshot() should preserve readOnly metadata for each scope', () => {
|
||||
const readonlySettings = new LoadedSettings(
|
||||
{
|
||||
path: getSystemSettingsPath(),
|
||||
settings: {},
|
||||
originalSettings: {},
|
||||
readOnly: true,
|
||||
},
|
||||
{
|
||||
path: getSystemDefaultsPath(),
|
||||
settings: {},
|
||||
originalSettings: {},
|
||||
readOnly: true,
|
||||
},
|
||||
{
|
||||
path: USER_SETTINGS_PATH,
|
||||
settings: {},
|
||||
originalSettings: {},
|
||||
readOnly: false,
|
||||
},
|
||||
{
|
||||
path: MOCK_WORKSPACE_SETTINGS_PATH,
|
||||
settings: {},
|
||||
originalSettings: {},
|
||||
readOnly: true,
|
||||
},
|
||||
true,
|
||||
[],
|
||||
);
|
||||
|
||||
const snapshot = readonlySettings.getSnapshot();
|
||||
|
||||
expect(snapshot.system.readOnly).toBe(true);
|
||||
expect(snapshot.systemDefaults.readOnly).toBe(true);
|
||||
expect(snapshot.user.readOnly).toBe(false);
|
||||
expect(snapshot.workspace.readOnly).toBe(true);
|
||||
});
|
||||
|
||||
it('setValue() should create a new snapshot reference and emit event', () => {
|
||||
const oldSnapshot = loadedSettings.getSnapshot();
|
||||
const oldUserRef = oldSnapshot.user.settings;
|
||||
|
||||
@@ -398,8 +398,7 @@ export class LoadedSettings {
|
||||
|
||||
private computeSnapshot(): LoadedSettingsSnapshot {
|
||||
const cloneSettingsFile = (file: SettingsFile): SettingsFile => ({
|
||||
path: file.path,
|
||||
rawJson: file.rawJson,
|
||||
...file,
|
||||
settings: structuredClone(file.settings),
|
||||
originalSettings: structuredClone(file.originalSettings),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user