refactor(cli): integrate real config loading into async test utils (#23040)

This commit is contained in:
Tommaso Sciortino
2026-03-19 17:05:33 +00:00
committed by GitHub
parent 7de0616229
commit 23264ced9a
103 changed files with 1806 additions and 1541 deletions
@@ -41,7 +41,7 @@ describe('ExtensionDetails', () => {
mockOnInstall = vi.fn();
});
const renderDetails = (isInstalled = false) =>
const renderDetails = async (isInstalled = false) =>
renderWithProviders(
<ExtensionDetails
extension={mockExtension}
@@ -52,7 +52,7 @@ describe('ExtensionDetails', () => {
);
it('should render extension details correctly', async () => {
const { lastFrame } = renderDetails();
const { lastFrame } = await renderDetails();
await waitFor(() => {
expect(lastFrame()).toContain('Test Extension');
expect(lastFrame()).toContain('v1.2.3');
@@ -69,7 +69,7 @@ describe('ExtensionDetails', () => {
});
it('should show install prompt when not installed', async () => {
const { lastFrame } = renderDetails(false);
const { lastFrame } = await renderDetails(false);
await waitFor(() => {
expect(lastFrame()).toContain('[Enter] Install');
expect(lastFrame()).not.toContain('Already Installed');
@@ -77,7 +77,7 @@ describe('ExtensionDetails', () => {
});
it('should show already installed message when installed', async () => {
const { lastFrame } = renderDetails(true);
const { lastFrame } = await renderDetails(true);
await waitFor(() => {
expect(lastFrame()).toContain('Already Installed');
expect(lastFrame()).not.toContain('[Enter] Install');
@@ -85,7 +85,7 @@ describe('ExtensionDetails', () => {
});
it('should call onBack when Escape is pressed', async () => {
const { stdin } = renderDetails();
const { stdin } = await renderDetails();
await React.act(async () => {
stdin.write('\x1b'); // Escape
});
@@ -95,7 +95,7 @@ describe('ExtensionDetails', () => {
});
it('should call onInstall when Enter is pressed and not installed', async () => {
const { stdin } = renderDetails(false);
const { stdin } = await renderDetails(false);
await React.act(async () => {
stdin.write('\r'); // Enter
});
@@ -106,7 +106,7 @@ describe('ExtensionDetails', () => {
it('should NOT call onInstall when Enter is pressed and already installed', async () => {
vi.useFakeTimers();
const { stdin } = renderDetails(true);
const { stdin } = await renderDetails(true);
await React.act(async () => {
stdin.write('\r'); // Enter
});