mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-26 04:54:25 -07:00
test(cli): refactor tests for async render utilities (#23252)
This commit is contained in:
committed by
GitHub
parent
86a3a913b5
commit
6c78eb7a39
@@ -93,7 +93,7 @@ describe('usePermissionsModifyTrust', () => {
|
||||
});
|
||||
|
||||
describe('when targetDirectory is the current workspace', () => {
|
||||
it('should initialize with the correct trust level', () => {
|
||||
it('should initialize with the correct trust level', async () => {
|
||||
mockedLoadTrustedFolders.mockReturnValue({
|
||||
user: { config: { '/test/dir': TrustLevel.TRUST_FOLDER } },
|
||||
} as unknown as LoadedTrustedFolders);
|
||||
@@ -102,14 +102,14 @@ describe('usePermissionsModifyTrust', () => {
|
||||
source: 'file',
|
||||
});
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
const { result } = await renderHook(() =>
|
||||
usePermissionsModifyTrust(mockOnExit, mockAddItem, mockedCwd()),
|
||||
);
|
||||
|
||||
expect(result.current.currentTrustLevel).toBe(TrustLevel.TRUST_FOLDER);
|
||||
});
|
||||
|
||||
it('should detect inherited trust from parent', () => {
|
||||
it('should detect inherited trust from parent', async () => {
|
||||
mockedLoadTrustedFolders.mockReturnValue({
|
||||
user: { config: {} },
|
||||
setValue: vi.fn(),
|
||||
@@ -119,7 +119,7 @@ describe('usePermissionsModifyTrust', () => {
|
||||
source: 'file',
|
||||
});
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
const { result } = await renderHook(() =>
|
||||
usePermissionsModifyTrust(mockOnExit, mockAddItem, mockedCwd()),
|
||||
);
|
||||
|
||||
@@ -127,7 +127,7 @@ describe('usePermissionsModifyTrust', () => {
|
||||
expect(result.current.isInheritedTrustFromIde).toBe(false);
|
||||
});
|
||||
|
||||
it('should detect inherited trust from IDE', () => {
|
||||
it('should detect inherited trust from IDE', async () => {
|
||||
mockedLoadTrustedFolders.mockReturnValue({
|
||||
user: { config: {} }, // No explicit trust
|
||||
} as unknown as LoadedTrustedFolders);
|
||||
@@ -136,7 +136,7 @@ describe('usePermissionsModifyTrust', () => {
|
||||
source: 'ide',
|
||||
});
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
const { result } = await renderHook(() =>
|
||||
usePermissionsModifyTrust(mockOnExit, mockAddItem, mockedCwd()),
|
||||
);
|
||||
|
||||
@@ -155,7 +155,7 @@ describe('usePermissionsModifyTrust', () => {
|
||||
.mockReturnValueOnce({ isTrusted: false, source: 'file' })
|
||||
.mockReturnValueOnce({ isTrusted: true, source: 'file' });
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
const { result } = await renderHook(() =>
|
||||
usePermissionsModifyTrust(mockOnExit, mockAddItem, mockedCwd()),
|
||||
);
|
||||
|
||||
@@ -179,7 +179,7 @@ describe('usePermissionsModifyTrust', () => {
|
||||
source: 'file',
|
||||
});
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
const { result } = await renderHook(() =>
|
||||
usePermissionsModifyTrust(mockOnExit, mockAddItem, mockedCwd()),
|
||||
);
|
||||
|
||||
@@ -206,7 +206,7 @@ describe('usePermissionsModifyTrust', () => {
|
||||
.mockReturnValueOnce({ isTrusted: false, source: 'file' })
|
||||
.mockReturnValueOnce({ isTrusted: true, source: 'file' });
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
const { result } = await renderHook(() =>
|
||||
usePermissionsModifyTrust(mockOnExit, mockAddItem, mockedCwd()),
|
||||
);
|
||||
|
||||
@@ -236,7 +236,7 @@ describe('usePermissionsModifyTrust', () => {
|
||||
source: 'file',
|
||||
});
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
const { result } = await renderHook(() =>
|
||||
usePermissionsModifyTrust(mockOnExit, mockAddItem, mockedCwd()),
|
||||
);
|
||||
|
||||
@@ -263,7 +263,7 @@ describe('usePermissionsModifyTrust', () => {
|
||||
source: 'ide',
|
||||
});
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
const { result } = await renderHook(() =>
|
||||
usePermissionsModifyTrust(mockOnExit, mockAddItem, mockedCwd()),
|
||||
);
|
||||
|
||||
@@ -284,7 +284,7 @@ describe('usePermissionsModifyTrust', () => {
|
||||
describe('when targetDirectory is not the current workspace', () => {
|
||||
const otherDirectory = '/other/dir';
|
||||
|
||||
it('should not detect inherited trust', () => {
|
||||
it('should not detect inherited trust', async () => {
|
||||
mockedLoadTrustedFolders.mockReturnValue({
|
||||
user: { config: {} },
|
||||
} as unknown as LoadedTrustedFolders);
|
||||
@@ -293,7 +293,7 @@ describe('usePermissionsModifyTrust', () => {
|
||||
source: 'file',
|
||||
});
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
const { result } = await renderHook(() =>
|
||||
usePermissionsModifyTrust(mockOnExit, mockAddItem, otherDirectory),
|
||||
);
|
||||
|
||||
@@ -312,7 +312,7 @@ describe('usePermissionsModifyTrust', () => {
|
||||
source: 'file',
|
||||
});
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
const { result } = await renderHook(() =>
|
||||
usePermissionsModifyTrust(mockOnExit, mockAddItem, otherDirectory),
|
||||
);
|
||||
|
||||
@@ -338,7 +338,7 @@ describe('usePermissionsModifyTrust', () => {
|
||||
source: 'file',
|
||||
});
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
const { result } = await renderHook(() =>
|
||||
usePermissionsModifyTrust(mockOnExit, mockAddItem, otherDirectory),
|
||||
);
|
||||
|
||||
@@ -366,7 +366,7 @@ describe('usePermissionsModifyTrust', () => {
|
||||
|
||||
const emitFeedbackSpy = vi.spyOn(coreEvents, 'emitFeedback');
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
const { result } = await renderHook(() =>
|
||||
usePermissionsModifyTrust(mockOnExit, mockAddItem, mockedCwd()),
|
||||
);
|
||||
|
||||
@@ -396,7 +396,7 @@ describe('usePermissionsModifyTrust', () => {
|
||||
|
||||
const emitFeedbackSpy = vi.spyOn(coreEvents, 'emitFeedback');
|
||||
|
||||
const { result } = renderHook(() =>
|
||||
const { result } = await renderHook(() =>
|
||||
usePermissionsModifyTrust(mockOnExit, mockAddItem, mockedCwd()),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user