mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-16 17:11:04 -07:00
feat: Add auto update functionality (#4686)
This commit is contained in:
@@ -50,7 +50,9 @@ describe('checkForUpdates', () => {
|
||||
name: 'test-package',
|
||||
version: '1.0.0',
|
||||
});
|
||||
updateNotifier.mockReturnValue({ update: null });
|
||||
updateNotifier.mockReturnValue({
|
||||
fetchInfo: vi.fn(async () => null),
|
||||
});
|
||||
const result = await checkForUpdates();
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
@@ -61,10 +63,12 @@ describe('checkForUpdates', () => {
|
||||
version: '1.0.0',
|
||||
});
|
||||
updateNotifier.mockReturnValue({
|
||||
update: { current: '1.0.0', latest: '1.1.0' },
|
||||
fetchInfo: vi.fn(async () => ({ current: '1.0.0', latest: '1.1.0' })),
|
||||
});
|
||||
|
||||
const result = await checkForUpdates();
|
||||
expect(result).toContain('1.0.0 → 1.1.0');
|
||||
expect(result?.message).toContain('1.0.0 → 1.1.0');
|
||||
expect(result?.update).toEqual({ current: '1.0.0', latest: '1.1.0' });
|
||||
});
|
||||
|
||||
it('should return null if the latest version is the same as the current version', async () => {
|
||||
@@ -73,7 +77,7 @@ describe('checkForUpdates', () => {
|
||||
version: '1.0.0',
|
||||
});
|
||||
updateNotifier.mockReturnValue({
|
||||
update: { current: '1.0.0', latest: '1.0.0' },
|
||||
fetchInfo: vi.fn(async () => ({ current: '1.0.0', latest: '1.0.0' })),
|
||||
});
|
||||
const result = await checkForUpdates();
|
||||
expect(result).toBeNull();
|
||||
@@ -85,7 +89,7 @@ describe('checkForUpdates', () => {
|
||||
version: '1.1.0',
|
||||
});
|
||||
updateNotifier.mockReturnValue({
|
||||
update: { current: '1.1.0', latest: '1.0.0' },
|
||||
fetchInfo: vi.fn(async () => ({ current: '1.0.0', latest: '0.09' })),
|
||||
});
|
||||
const result = await checkForUpdates();
|
||||
expect(result).toBeNull();
|
||||
|
||||
Reference in New Issue
Block a user