refactor(cli): simplify keypress and mouse providers and update tests (#22853)

This commit is contained in:
Tommaso Sciortino
2026-03-18 16:38:56 +00:00
committed by GitHub
parent 81a97e78f1
commit d7dfcf7f99
40 changed files with 923 additions and 863 deletions
+2 -7
View File
@@ -4,12 +4,11 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { render } from '../../test-utils/render.js';
import { renderWithProviders } from '../../test-utils/render.js';
import { EventEmitter } from 'node:events';
import { useFocus } from './useFocus.js';
import { vi, type Mock } from 'vitest';
import { useStdin, useStdout } from 'ink';
import { KeypressProvider } from '../contexts/KeypressContext.js';
import { act } from 'react';
// Mock the ink hooks
@@ -54,11 +53,7 @@ describe('useFocus', () => {
hookResult = useFocus();
return null;
}
const { unmount } = render(
<KeypressProvider>
<TestComponent />
</KeypressProvider>,
);
const { unmount } = renderWithProviders(<TestComponent />);
return {
result: {
get current() {