mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-26 13:04:49 -07:00
refactor(cli): integrate real config loading into async test utils (#23040)
This commit is contained in:
committed by
GitHub
parent
7de0616229
commit
23264ced9a
@@ -48,10 +48,13 @@ describe('useSnowfall', () => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
it('initially enables animation during holiday season with Holiday theme', () => {
|
||||
const { result } = renderHookWithProviders(() => useSnowfall(mockArt), {
|
||||
uiState: { history: [], historyRemountKey: 0 } as Partial<UIState>,
|
||||
});
|
||||
it('initially enables animation during holiday season with Holiday theme', async () => {
|
||||
const { result } = await renderHookWithProviders(
|
||||
() => useSnowfall(mockArt),
|
||||
{
|
||||
uiState: { history: [], historyRemountKey: 0 } as Partial<UIState>,
|
||||
},
|
||||
);
|
||||
|
||||
// Should contain holiday trees
|
||||
expect(result.current).toContain('|_|');
|
||||
@@ -59,10 +62,13 @@ describe('useSnowfall', () => {
|
||||
expect(debugState.debugNumAnimatedComponents).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('stops animation after 15 seconds', () => {
|
||||
const { result } = renderHookWithProviders(() => useSnowfall(mockArt), {
|
||||
uiState: { history: [], historyRemountKey: 0 } as Partial<UIState>,
|
||||
});
|
||||
it('stops animation after 15 seconds', async () => {
|
||||
const { result } = await renderHookWithProviders(
|
||||
() => useSnowfall(mockArt),
|
||||
{
|
||||
uiState: { history: [], historyRemountKey: 0 } as Partial<UIState>,
|
||||
},
|
||||
);
|
||||
|
||||
expect(debugState.debugNumAnimatedComponents).toBeGreaterThan(0);
|
||||
|
||||
@@ -76,35 +82,44 @@ describe('useSnowfall', () => {
|
||||
expect(result.current).toBe(mockArt);
|
||||
});
|
||||
|
||||
it('does not enable animation if not holiday season', () => {
|
||||
it('does not enable animation if not holiday season', async () => {
|
||||
vi.setSystemTime(new Date('2025-06-15'));
|
||||
const { result } = renderHookWithProviders(() => useSnowfall(mockArt), {
|
||||
uiState: { history: [], historyRemountKey: 0 } as Partial<UIState>,
|
||||
});
|
||||
const { result } = await renderHookWithProviders(
|
||||
() => useSnowfall(mockArt),
|
||||
{
|
||||
uiState: { history: [], historyRemountKey: 0 } as Partial<UIState>,
|
||||
},
|
||||
);
|
||||
|
||||
expect(result.current).toBe(mockArt);
|
||||
expect(debugState.debugNumAnimatedComponents).toBe(0);
|
||||
});
|
||||
|
||||
it('does not enable animation if theme is not Holiday', () => {
|
||||
it('does not enable animation if theme is not Holiday', async () => {
|
||||
vi.mocked(themeManager.getActiveTheme).mockReturnValue({
|
||||
name: 'Default',
|
||||
} as Theme);
|
||||
const { result } = renderHookWithProviders(() => useSnowfall(mockArt), {
|
||||
uiState: { history: [], historyRemountKey: 0 } as Partial<UIState>,
|
||||
});
|
||||
const { result } = await renderHookWithProviders(
|
||||
() => useSnowfall(mockArt),
|
||||
{
|
||||
uiState: { history: [], historyRemountKey: 0 } as Partial<UIState>,
|
||||
},
|
||||
);
|
||||
|
||||
expect(result.current).toBe(mockArt);
|
||||
expect(debugState.debugNumAnimatedComponents).toBe(0);
|
||||
});
|
||||
|
||||
it('does not enable animation if chat has started', () => {
|
||||
const { result } = renderHookWithProviders(() => useSnowfall(mockArt), {
|
||||
uiState: {
|
||||
history: [{ type: 'user', text: 'hello' }],
|
||||
historyRemountKey: 0,
|
||||
} as Partial<UIState>,
|
||||
});
|
||||
it('does not enable animation if chat has started', async () => {
|
||||
const { result } = await renderHookWithProviders(
|
||||
() => useSnowfall(mockArt),
|
||||
{
|
||||
uiState: {
|
||||
history: [{ type: 'user', text: 'hello' }],
|
||||
historyRemountKey: 0,
|
||||
} as Partial<UIState>,
|
||||
},
|
||||
);
|
||||
|
||||
expect(result.current).toBe(mockArt);
|
||||
expect(debugState.debugNumAnimatedComponents).toBe(0);
|
||||
|
||||
Reference in New Issue
Block a user