mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-12 02:50:41 -07:00
test(cli): refactor tests for async render utilities (#23252)
This commit is contained in:
committed by
GitHub
parent
86a3a913b5
commit
6c78eb7a39
@@ -77,14 +77,14 @@ describe('useEditorSettings', () => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('should initialize with dialog closed', () => {
|
||||
render(<TestComponent />);
|
||||
it('should initialize with dialog closed', async () => {
|
||||
await render(<TestComponent />);
|
||||
|
||||
expect(result.isEditorDialogOpen).toBe(false);
|
||||
});
|
||||
|
||||
it('should open editor dialog when openEditorDialog is called', () => {
|
||||
render(<TestComponent />);
|
||||
it('should open editor dialog when openEditorDialog is called', async () => {
|
||||
await render(<TestComponent />);
|
||||
|
||||
act(() => {
|
||||
result.openEditorDialog();
|
||||
@@ -93,8 +93,8 @@ describe('useEditorSettings', () => {
|
||||
expect(result.isEditorDialogOpen).toBe(true);
|
||||
});
|
||||
|
||||
it('should close editor dialog when exitEditorDialog is called', () => {
|
||||
render(<TestComponent />);
|
||||
it('should close editor dialog when exitEditorDialog is called', async () => {
|
||||
await render(<TestComponent />);
|
||||
act(() => {
|
||||
result.openEditorDialog();
|
||||
result.exitEditorDialog();
|
||||
@@ -102,8 +102,8 @@ describe('useEditorSettings', () => {
|
||||
expect(result.isEditorDialogOpen).toBe(false);
|
||||
});
|
||||
|
||||
it('should handle editor selection successfully', () => {
|
||||
render(<TestComponent />);
|
||||
it('should handle editor selection successfully', async () => {
|
||||
await render(<TestComponent />);
|
||||
|
||||
const editorType: EditorType = 'vscode';
|
||||
const scope = SettingScope.User;
|
||||
@@ -131,8 +131,8 @@ describe('useEditorSettings', () => {
|
||||
expect(result.isEditorDialogOpen).toBe(false);
|
||||
});
|
||||
|
||||
it('should handle clearing editor preference (undefined editor)', () => {
|
||||
render(<TestComponent />);
|
||||
it('should handle clearing editor preference (undefined editor)', async () => {
|
||||
await render(<TestComponent />);
|
||||
|
||||
const scope = SettingScope.Workspace;
|
||||
|
||||
@@ -159,8 +159,8 @@ describe('useEditorSettings', () => {
|
||||
expect(result.isEditorDialogOpen).toBe(false);
|
||||
});
|
||||
|
||||
it('should handle different editor types', () => {
|
||||
render(<TestComponent />);
|
||||
it('should handle different editor types', async () => {
|
||||
await render(<TestComponent />);
|
||||
|
||||
const editorTypes: EditorType[] = ['cursor', 'windsurf', 'vim'];
|
||||
const displayNames: Record<string, string> = {
|
||||
@@ -191,8 +191,8 @@ describe('useEditorSettings', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should handle different setting scopes', () => {
|
||||
render(<TestComponent />);
|
||||
it('should handle different setting scopes', async () => {
|
||||
await render(<TestComponent />);
|
||||
|
||||
const editorType: EditorType = 'vscode';
|
||||
const scopes: LoadableSettingScope[] = [
|
||||
@@ -221,8 +221,8 @@ describe('useEditorSettings', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should not set preference for unavailable editors', () => {
|
||||
render(<TestComponent />);
|
||||
it('should not set preference for unavailable editors', async () => {
|
||||
await render(<TestComponent />);
|
||||
|
||||
mockHasValidEditorCommand.mockReturnValue(false);
|
||||
|
||||
@@ -239,8 +239,8 @@ describe('useEditorSettings', () => {
|
||||
expect(result.isEditorDialogOpen).toBe(true);
|
||||
});
|
||||
|
||||
it('should not set preference for editors not allowed in sandbox', () => {
|
||||
render(<TestComponent />);
|
||||
it('should not set preference for editors not allowed in sandbox', async () => {
|
||||
await render(<TestComponent />);
|
||||
|
||||
mockAllowEditorTypeInSandbox.mockReturnValue(false);
|
||||
|
||||
@@ -257,8 +257,8 @@ describe('useEditorSettings', () => {
|
||||
expect(result.isEditorDialogOpen).toBe(true);
|
||||
});
|
||||
|
||||
it('should handle errors during editor selection', () => {
|
||||
render(<TestComponent />);
|
||||
it('should handle errors during editor selection', async () => {
|
||||
await render(<TestComponent />);
|
||||
|
||||
const errorMessage = 'Failed to save settings';
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user