mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-15 16:41:11 -07:00
Make merged settings non-nullable and fix all lints related to that. (#16647)
This commit is contained in:
@@ -14,6 +14,7 @@ import EventEmitter from 'node:events';
|
||||
import type { ChildProcess } from 'node:child_process';
|
||||
import { handleAutoUpdate, setUpdateHandler } from './handleAutoUpdate.js';
|
||||
import { MessageType } from '../ui/types.js';
|
||||
import { mergeSettings } from '../config/settings.js';
|
||||
|
||||
vi.mock('./installationInfo.js', async () => {
|
||||
const actual = await vi.importActual('./installationInfo.js');
|
||||
@@ -49,12 +50,9 @@ describe('handleAutoUpdate', () => {
|
||||
message: 'An update is available!',
|
||||
};
|
||||
|
||||
const defaultMergedSettings = mergeSettings({}, {}, {}, {}, true);
|
||||
mockSettings = {
|
||||
merged: {
|
||||
general: {
|
||||
disableAutoUpdate: false,
|
||||
},
|
||||
},
|
||||
merged: defaultMergedSettings,
|
||||
} as LoadedSettings;
|
||||
|
||||
mockChildProcess = Object.assign(new EventEmitter(), {
|
||||
@@ -82,7 +80,7 @@ describe('handleAutoUpdate', () => {
|
||||
});
|
||||
|
||||
it('should do nothing if update nag is disabled', () => {
|
||||
mockSettings.merged.general!.disableUpdateNag = true;
|
||||
mockSettings.merged.general.disableUpdateNag = true;
|
||||
handleAutoUpdate(mockUpdateInfo, mockSettings, '/root', mockSpawn);
|
||||
expect(mockGetInstallationInfo).not.toHaveBeenCalled();
|
||||
expect(updateEventEmitter.emit).not.toHaveBeenCalled();
|
||||
@@ -90,7 +88,7 @@ describe('handleAutoUpdate', () => {
|
||||
});
|
||||
|
||||
it('should emit "update-received" but not update if auto-updates are disabled', () => {
|
||||
mockSettings.merged.general!.disableAutoUpdate = true;
|
||||
mockSettings.merged.general.disableAutoUpdate = true;
|
||||
mockGetInstallationInfo.mockReturnValue({
|
||||
updateCommand: 'npm i -g @google/gemini-cli@latest',
|
||||
updateMessage: 'Please update manually.',
|
||||
|
||||
Reference in New Issue
Block a user