mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-26 04:54:25 -07:00
Conditionally use consent flow (#8551)
This commit is contained in:
@@ -596,7 +596,7 @@ describe('extension tests', () => {
|
||||
mockQuestion.mockImplementation((_query, callback) => callback('y'));
|
||||
|
||||
await expect(
|
||||
installExtension({ source: sourceExtDir, type: 'local' }),
|
||||
installExtension({ source: sourceExtDir, type: 'local' }, true),
|
||||
).resolves.toBe('my-local-extension');
|
||||
|
||||
expect(consoleInfoSpy).toHaveBeenCalledWith(
|
||||
@@ -629,7 +629,7 @@ describe('extension tests', () => {
|
||||
mockQuestion.mockImplementation((_query, callback) => callback('y'));
|
||||
|
||||
await expect(
|
||||
installExtension({ source: sourceExtDir, type: 'local' }),
|
||||
installExtension({ source: sourceExtDir, type: 'local' }, true),
|
||||
).resolves.toBe('my-local-extension');
|
||||
|
||||
expect(mockQuestion).toHaveBeenCalledWith(
|
||||
@@ -654,7 +654,7 @@ describe('extension tests', () => {
|
||||
mockQuestion.mockImplementation((_query, callback) => callback('n'));
|
||||
|
||||
await expect(
|
||||
installExtension({ source: sourceExtDir, type: 'local' }),
|
||||
installExtension({ source: sourceExtDir, type: 'local' }, true),
|
||||
).rejects.toThrow('Installation cancelled by user.');
|
||||
|
||||
expect(mockQuestion).toHaveBeenCalledWith(
|
||||
@@ -662,6 +662,24 @@ describe('extension tests', () => {
|
||||
expect.any(Function),
|
||||
);
|
||||
});
|
||||
|
||||
it('should ignore consent flow if not required', async () => {
|
||||
const sourceExtDir = createExtension({
|
||||
extensionsDir: tempHomeDir,
|
||||
name: 'my-local-extension',
|
||||
version: '1.0.0',
|
||||
mcpServers: {
|
||||
'test-server': {
|
||||
command: 'node',
|
||||
args: ['server.js'],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await expect(
|
||||
installExtension({ source: sourceExtDir, type: 'local' }, false),
|
||||
).resolves.toBe('my-local-extension');
|
||||
});
|
||||
});
|
||||
|
||||
describe('uninstallExtension', () => {
|
||||
|
||||
Reference in New Issue
Block a user