mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-21 19:40:40 -07:00
fix(ui): update HookStatusDisplay tests for extension visibility and refactor to stable pattern
This commit is contained in:
@@ -18,12 +18,10 @@ describe('<HookStatusDisplay />', () => {
|
||||
const props = {
|
||||
activeHooks: [{ name: 'test-hook', eventName: 'BeforeAgent' }],
|
||||
};
|
||||
const { lastFrame, waitUntilReady, unmount } = render(
|
||||
<HookStatusDisplay {...props} />,
|
||||
);
|
||||
await waitUntilReady();
|
||||
expect(lastFrame()).toMatchSnapshot();
|
||||
unmount();
|
||||
const result = render(<HookStatusDisplay {...props} />);
|
||||
await result.waitUntilReady();
|
||||
expect(result.lastFrame()).toMatchSnapshot();
|
||||
result.unmount();
|
||||
});
|
||||
|
||||
it('should render multiple executing hooks', async () => {
|
||||
@@ -33,12 +31,10 @@ describe('<HookStatusDisplay />', () => {
|
||||
{ name: 'h2', eventName: 'BeforeAgent' },
|
||||
],
|
||||
};
|
||||
const { lastFrame, waitUntilReady, unmount } = render(
|
||||
<HookStatusDisplay {...props} />,
|
||||
);
|
||||
await waitUntilReady();
|
||||
expect(lastFrame()).toMatchSnapshot();
|
||||
unmount();
|
||||
const result = render(<HookStatusDisplay {...props} />);
|
||||
await result.waitUntilReady();
|
||||
expect(result.lastFrame()).toMatchSnapshot();
|
||||
result.unmount();
|
||||
});
|
||||
|
||||
it('should render sequential hook progress', async () => {
|
||||
@@ -47,36 +43,30 @@ describe('<HookStatusDisplay />', () => {
|
||||
{ name: 'step', eventName: 'BeforeAgent', index: 1, total: 3 },
|
||||
],
|
||||
};
|
||||
const { lastFrame, waitUntilReady, unmount } = render(
|
||||
<HookStatusDisplay {...props} />,
|
||||
);
|
||||
await waitUntilReady();
|
||||
expect(lastFrame()).toMatchSnapshot();
|
||||
unmount();
|
||||
const result = render(<HookStatusDisplay {...props} />);
|
||||
await result.waitUntilReady();
|
||||
expect(result.lastFrame()).toMatchSnapshot();
|
||||
result.unmount();
|
||||
});
|
||||
|
||||
it('should return empty string if no active hooks', async () => {
|
||||
const props = { activeHooks: [] };
|
||||
const { lastFrame, waitUntilReady, unmount } = render(
|
||||
<HookStatusDisplay {...props} />,
|
||||
);
|
||||
await waitUntilReady();
|
||||
expect(lastFrame({ allowEmpty: true })).toBe('');
|
||||
unmount();
|
||||
const result = render(<HookStatusDisplay {...props} />);
|
||||
await result.waitUntilReady();
|
||||
expect(result.lastFrame({ allowEmpty: true })).toBe('');
|
||||
result.unmount();
|
||||
});
|
||||
|
||||
it('should show generic message when only system/extension hooks are active', async () => {
|
||||
it('should show generic message when only system hooks are active', async () => {
|
||||
const props = {
|
||||
activeHooks: [
|
||||
{ name: 'ext-hook', eventName: 'BeforeAgent', source: 'extensions' },
|
||||
{ name: 'sys-hook', eventName: 'BeforeAgent', source: 'system' },
|
||||
],
|
||||
};
|
||||
const { lastFrame, waitUntilReady, unmount } = render(
|
||||
<HookStatusDisplay {...props} />,
|
||||
);
|
||||
await waitUntilReady();
|
||||
expect(lastFrame()).toContain('Working...');
|
||||
unmount();
|
||||
const result = render(<HookStatusDisplay {...props} />);
|
||||
await result.waitUntilReady();
|
||||
expect(result.lastFrame()).toContain('Working...');
|
||||
result.unmount();
|
||||
});
|
||||
|
||||
it('matches SVG snapshot for single hook', async () => {
|
||||
@@ -85,9 +75,9 @@ describe('<HookStatusDisplay />', () => {
|
||||
{ name: 'test-hook', eventName: 'BeforeAgent', source: 'user' },
|
||||
],
|
||||
};
|
||||
const renderResult = render(<HookStatusDisplay {...props} />);
|
||||
await renderResult.waitUntilReady();
|
||||
await expect(renderResult).toMatchSvgSnapshot();
|
||||
renderResult.unmount();
|
||||
const result = render(<HookStatusDisplay {...props} />);
|
||||
await result.waitUntilReady();
|
||||
await expect(result).toMatchSvgSnapshot();
|
||||
result.unmount();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user