diff --git a/packages/cli/src/ui/components/HookStatusDisplay.test.tsx b/packages/cli/src/ui/components/HookStatusDisplay.test.tsx index 4cb964b750..a1ed22b7c4 100644 --- a/packages/cli/src/ui/components/HookStatusDisplay.test.tsx +++ b/packages/cli/src/ui/components/HookStatusDisplay.test.tsx @@ -18,12 +18,10 @@ describe('', () => { const props = { activeHooks: [{ name: 'test-hook', eventName: 'BeforeAgent' }], }; - const { lastFrame, waitUntilReady, unmount } = render( - , - ); - await waitUntilReady(); - expect(lastFrame()).toMatchSnapshot(); - unmount(); + const result = render(); + await result.waitUntilReady(); + expect(result.lastFrame()).toMatchSnapshot(); + result.unmount(); }); it('should render multiple executing hooks', async () => { @@ -33,12 +31,10 @@ describe('', () => { { name: 'h2', eventName: 'BeforeAgent' }, ], }; - const { lastFrame, waitUntilReady, unmount } = render( - , - ); - await waitUntilReady(); - expect(lastFrame()).toMatchSnapshot(); - unmount(); + const result = render(); + await result.waitUntilReady(); + expect(result.lastFrame()).toMatchSnapshot(); + result.unmount(); }); it('should render sequential hook progress', async () => { @@ -47,36 +43,30 @@ describe('', () => { { name: 'step', eventName: 'BeforeAgent', index: 1, total: 3 }, ], }; - const { lastFrame, waitUntilReady, unmount } = render( - , - ); - await waitUntilReady(); - expect(lastFrame()).toMatchSnapshot(); - unmount(); + const result = render(); + 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( - , - ); - await waitUntilReady(); - expect(lastFrame({ allowEmpty: true })).toBe(''); - unmount(); + const result = render(); + 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( - , - ); - await waitUntilReady(); - expect(lastFrame()).toContain('Working...'); - unmount(); + const result = render(); + await result.waitUntilReady(); + expect(result.lastFrame()).toContain('Working...'); + result.unmount(); }); it('matches SVG snapshot for single hook', async () => { @@ -85,9 +75,9 @@ describe('', () => { { name: 'test-hook', eventName: 'BeforeAgent', source: 'user' }, ], }; - const renderResult = render(); - await renderResult.waitUntilReady(); - await expect(renderResult).toMatchSvgSnapshot(); - renderResult.unmount(); + const result = render(); + await result.waitUntilReady(); + await expect(result).toMatchSvgSnapshot(); + result.unmount(); }); });