mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-17 01:21:10 -07:00
Refactor PolicyEngine to Core Package (#12325)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
@@ -96,6 +96,7 @@ describe('BuiltinCommandLoader', () => {
|
||||
mockConfig = {
|
||||
getFolderTrust: vi.fn().mockReturnValue(true),
|
||||
getUseModelRouter: () => false,
|
||||
getEnableMessageBusIntegration: () => false,
|
||||
} as unknown as Config;
|
||||
|
||||
restoreCommandMock.mockReturnValue({
|
||||
@@ -187,6 +188,28 @@ describe('BuiltinCommandLoader', () => {
|
||||
const modelCmd = commands.find((c) => c.name === 'model');
|
||||
expect(modelCmd).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should include policies command when message bus integration is enabled', async () => {
|
||||
const mockConfigWithMessageBus = {
|
||||
...mockConfig,
|
||||
getEnableMessageBusIntegration: () => true,
|
||||
} as unknown as Config;
|
||||
const loader = new BuiltinCommandLoader(mockConfigWithMessageBus);
|
||||
const commands = await loader.loadCommands(new AbortController().signal);
|
||||
const policiesCmd = commands.find((c) => c.name === 'policies');
|
||||
expect(policiesCmd).toBeDefined();
|
||||
});
|
||||
|
||||
it('should exclude policies command when message bus integration is disabled', async () => {
|
||||
const mockConfigWithoutMessageBus = {
|
||||
...mockConfig,
|
||||
getEnableMessageBusIntegration: () => false,
|
||||
} as unknown as Config;
|
||||
const loader = new BuiltinCommandLoader(mockConfigWithoutMessageBus);
|
||||
const commands = await loader.loadCommands(new AbortController().signal);
|
||||
const policiesCmd = commands.find((c) => c.name === 'policies');
|
||||
expect(policiesCmd).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('BuiltinCommandLoader profile', () => {
|
||||
@@ -198,6 +221,7 @@ describe('BuiltinCommandLoader profile', () => {
|
||||
getFolderTrust: vi.fn().mockReturnValue(false),
|
||||
getUseModelRouter: () => false,
|
||||
getCheckpointingEnabled: () => false,
|
||||
getEnableMessageBusIntegration: () => false,
|
||||
} as unknown as Config;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user