summaryrefslogtreecommitdiff
path: root/packages/cli/src
diff options
context:
space:
mode:
authorJacob Richman <[email protected]>2025-08-14 23:04:48 -0700
committerGitHub <[email protected]>2025-08-15 06:04:48 +0000
commit2690123af0969fead14f4a106119cd6d82fdcbc1 (patch)
tree7b075406905ade6114dd2440e206a0da0471f4fe /packages/cli/src
parentd46b91e09db7e541ebefeb18b145199954bc95ea (diff)
Fix flaky test for SettingsDialog. (#6294)
Diffstat (limited to 'packages/cli/src')
-rw-r--r--packages/cli/src/ui/components/SettingsDialog.test.tsx38
1 files changed, 22 insertions, 16 deletions
diff --git a/packages/cli/src/ui/components/SettingsDialog.test.tsx b/packages/cli/src/ui/components/SettingsDialog.test.tsx
index ed67dcf9..94f33561 100644
--- a/packages/cli/src/ui/components/SettingsDialog.test.tsx
+++ b/packages/cli/src/ui/components/SettingsDialog.test.tsx
@@ -22,6 +22,7 @@
*/
import { render } from 'ink-testing-library';
+import { waitFor } from '@testing-library/react';
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { SettingsDialog } from './SettingsDialog.js';
import { LoadedSettings, SettingScope } from '../../config/settings.js';
@@ -285,12 +286,15 @@ describe('SettingsDialog', () => {
// Switch to scope focus
stdin.write('\t'); // Tab key
- await wait();
- expect(lastFrame()).toContain('> Apply To');
+ await waitFor(() => {
+ expect(lastFrame()).toContain('> Apply To');
+ });
// Select a scope
stdin.write('1'); // Select first scope option
- await wait();
+ await waitFor(() => {
+ expect(lastFrame()).toContain(' Apply To');
+ });
// Should be back to settings focus
expect(lastFrame()).toContain(' Apply To');
@@ -351,9 +355,9 @@ describe('SettingsDialog', () => {
// Press Escape key
stdin.write('\u001B'); // ESC key
- await wait();
-
- expect(onSelect).toHaveBeenCalledWith(undefined, SettingScope.User);
+ await waitFor(() => {
+ expect(onSelect).toHaveBeenCalledWith(undefined, SettingScope.User);
+ });
unmount();
});
@@ -549,9 +553,9 @@ describe('SettingsDialog', () => {
describe('Settings Display Values', () => {
it('should show correct values for inherited settings', () => {
const settings = createMockSettings(
- {}, // No user settings
+ {},
{ vimMode: true, hideWindowTitle: false }, // System settings
- {}, // No workspace settings
+ {},
);
const onSelect = vi.fn();
@@ -568,7 +572,7 @@ describe('SettingsDialog', () => {
const settings = createMockSettings(
{ vimMode: false }, // User overrides
{ vimMode: true }, // System default
- {}, // No workspace settings
+ {},
);
const onSelect = vi.fn();
@@ -664,13 +668,15 @@ describe('SettingsDialog', () => {
// Tab to scope section
stdin.write('\t');
- await wait();
- expect(lastFrame()).toContain('> Apply To');
+ await waitFor(() => {
+ expect(lastFrame()).toContain('> Apply To');
+ });
// Tab back to settings section
stdin.write('\t');
- await wait();
- expect(lastFrame()).toContain(' Apply To');
+ await waitFor(() => {
+ expect(lastFrame()).toContain(' Apply To');
+ });
unmount();
});
@@ -746,9 +752,9 @@ describe('SettingsDialog', () => {
// Exit
stdin.write('\u001B'); // Escape
- await wait();
-
- expect(onSelect).toHaveBeenCalledWith(undefined, expect.any(String));
+ await waitFor(() => {
+ expect(onSelect).toHaveBeenCalledWith(undefined, expect.any(String));
+ });
unmount();
});