mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-22 02:54:31 -07:00
refactor: make baseTimestamp optional in addItem and remove redundant calls (#16471)
This commit is contained in:
@@ -11,7 +11,7 @@ import {
|
||||
MultiFolderTrustChoice,
|
||||
type MultiFolderTrustDialogProps,
|
||||
} from './MultiFolderTrustDialog.js';
|
||||
import { vi } from 'vitest';
|
||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||
import {
|
||||
TrustLevel,
|
||||
type LoadedTrustedFolders,
|
||||
@@ -213,13 +213,10 @@ describe('MultiFolderTrustDialog', () => {
|
||||
onSelect(MultiFolderTrustChoice.YES);
|
||||
});
|
||||
|
||||
expect(mockAddItem).toHaveBeenCalledWith(
|
||||
{
|
||||
type: MessageType.ERROR,
|
||||
text: 'Configuration is not available.',
|
||||
},
|
||||
expect.any(Number),
|
||||
);
|
||||
expect(mockAddItem).toHaveBeenCalledWith({
|
||||
type: MessageType.ERROR,
|
||||
text: 'Configuration is not available.',
|
||||
});
|
||||
expect(mockOnComplete).toHaveBeenCalled();
|
||||
expect(mockFinishAddingDirectories).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -31,13 +31,16 @@ export interface MultiFolderTrustDialogProps {
|
||||
config: Config,
|
||||
addItem: (
|
||||
itemData: Omit<HistoryItem, 'id'>,
|
||||
baseTimestamp: number,
|
||||
baseTimestamp?: number,
|
||||
) => number,
|
||||
added: string[],
|
||||
errors: string[],
|
||||
) => Promise<void>;
|
||||
config: Config;
|
||||
addItem: (itemData: Omit<HistoryItem, 'id'>, baseTimestamp: number) => number;
|
||||
addItem: (
|
||||
itemData: Omit<HistoryItem, 'id'>,
|
||||
baseTimestamp?: number,
|
||||
) => number;
|
||||
}
|
||||
|
||||
export const MultiFolderTrustDialog: React.FC<MultiFolderTrustDialogProps> = ({
|
||||
@@ -95,13 +98,10 @@ export const MultiFolderTrustDialog: React.FC<MultiFolderTrustDialogProps> = ({
|
||||
setSubmitted(true);
|
||||
|
||||
if (!config) {
|
||||
addItem(
|
||||
{
|
||||
type: MessageType.ERROR,
|
||||
text: 'Configuration is not available.',
|
||||
},
|
||||
Date.now(),
|
||||
);
|
||||
addItem({
|
||||
type: MessageType.ERROR,
|
||||
text: 'Configuration is not available.',
|
||||
});
|
||||
onComplete();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user