mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-09 09:30:41 -07:00
fix(cli): prevent automatic updates from switching to less stable channels (#26132)
This commit is contained in:
@@ -334,7 +334,8 @@ describe('handleAutoUpdate', () => {
|
||||
...mockUpdateInfo,
|
||||
update: {
|
||||
...mockUpdateInfo.update,
|
||||
latest: '2.0.0-nightly',
|
||||
current: '1.0.0-nightly.0',
|
||||
latest: '2.0.0-nightly.1',
|
||||
},
|
||||
};
|
||||
mockGetInstallationInfo.mockReturnValue({
|
||||
@@ -356,6 +357,26 @@ describe('handleAutoUpdate', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should NOT update if target is less stable than current (defense-in-depth)', async () => {
|
||||
mockUpdateInfo = {
|
||||
...mockUpdateInfo,
|
||||
update: {
|
||||
...mockUpdateInfo.update,
|
||||
current: '1.0.0',
|
||||
latest: '1.1.0-nightly.1',
|
||||
},
|
||||
};
|
||||
mockGetInstallationInfo.mockReturnValue({
|
||||
updateCommand: 'npm i -g @google/gemini-cli@latest',
|
||||
isGlobal: false,
|
||||
packageManager: PackageManager.NPM,
|
||||
});
|
||||
|
||||
handleAutoUpdate(mockUpdateInfo, mockSettings, '/root', mockSpawn);
|
||||
|
||||
expect(mockSpawn).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should emit "update-success" when the update process succeeds', async () => {
|
||||
await new Promise<void>((resolve) => {
|
||||
mockGetInstallationInfo.mockReturnValue({
|
||||
|
||||
Reference in New Issue
Block a user