chore: fix TS compilation errors resulting from rebase

This commit is contained in:
Spencer
2026-03-24 17:27:13 +00:00
parent 000c189a0a
commit f339e61a55
4 changed files with 15 additions and 28 deletions
@@ -35,7 +35,7 @@ describe('ApprovalModeIndicator', () => {
});
it('renders correctly for YOLO mode', async () => {
const { lastFrame, waitUntilReady } = await render(
const { lastFrame } = await render(
<ApprovalModeIndicator
approvalMode={ApprovalMode.DEFAULT}
isWildcardPolicyEnabled={true}
@@ -162,18 +162,6 @@ describe('useApprovalModeIndicator', () => {
expect(mockConfigInstance.getApprovalMode).toHaveBeenCalledTimes(1);
});
it('should initialize with ApprovalMode.YOLO if config.getApprovalMode returns ApprovalMode.YOLO', async () => {
mockConfigInstance.getApprovalMode.mockReturnValue(ApprovalMode.YOLO);
const { result } = await renderHook(() =>
useApprovalModeIndicator({
config: mockConfigInstance as unknown as ActualConfigType,
addItem: vi.fn(),
}),
);
expect(result.current).toBe(ApprovalMode.YOLO);
expect(mockConfigInstance.getApprovalMode).toHaveBeenCalledTimes(1);
});
it('should cycle the indicator and update config when Shift+Tab or Ctrl+Y is pressed', async () => {
mockConfigInstance.getApprovalMode.mockReturnValue(ApprovalMode.DEFAULT);
const { result } = await renderHook(() =>
@@ -200,9 +188,9 @@ describe('useApprovalModeIndicator', () => {
capturedUseKeypressHandler({ name: 'y', ctrl: true } as Key);
});
expect(mockConfigInstance.setApprovalMode).toHaveBeenCalledWith(
ApprovalMode.YOLO,
ApprovalMode.DEFAULT,
);
expect(result.current).toBe(ApprovalMode.YOLO);
expect(result.current).toBe(ApprovalMode.DEFAULT);
// Shift+Tab cycles back to AUTO_EDIT (from YOLO)
act(() => {
@@ -221,9 +209,9 @@ describe('useApprovalModeIndicator', () => {
capturedUseKeypressHandler({ name: 'y', ctrl: true } as Key);
});
expect(mockConfigInstance.setApprovalMode).toHaveBeenCalledWith(
ApprovalMode.YOLO,
ApprovalMode.DEFAULT,
);
expect(result.current).toBe(ApprovalMode.YOLO);
expect(result.current).toBe(ApprovalMode.DEFAULT);
// Shift+Tab from YOLO jumps to AUTO_EDIT
act(() => {
@@ -349,7 +337,7 @@ describe('useApprovalModeIndicator', () => {
// We expect setApprovalMode to be called, and the error to be caught.
expect(mockConfigInstance.setApprovalMode).toHaveBeenCalledWith(
ApprovalMode.YOLO,
ApprovalMode.DEFAULT,
);
expect(mockAddItem).toHaveBeenCalled();
// Verify the underlying config value was not changed
@@ -390,7 +378,7 @@ describe('useApprovalModeIndicator', () => {
});
it('should disable YOLO mode when Ctrl+Y is pressed', async () => {
mockConfigInstance.getApprovalMode.mockReturnValue(ApprovalMode.YOLO);
mockConfigInstance.getApprovalMode.mockReturnValue(ApprovalMode.DEFAULT);
const mockAddItem = vi.fn();
await renderHook(() =>
useApprovalModeIndicator({
@@ -594,9 +582,9 @@ describe('useApprovalModeIndicator', () => {
});
expect(mockConfigInstance.setApprovalMode).toHaveBeenCalledWith(
ApprovalMode.YOLO,
ApprovalMode.DEFAULT,
);
expect(mockOnApprovalModeChange).toHaveBeenCalledWith(ApprovalMode.YOLO);
expect(mockOnApprovalModeChange).toHaveBeenCalledWith(ApprovalMode.DEFAULT);
});
it('should call onApprovalModeChange when switching to AUTO_EDIT mode', async () => {
@@ -624,7 +612,7 @@ describe('useApprovalModeIndicator', () => {
});
it('should call onApprovalModeChange when switching to DEFAULT mode', async () => {
mockConfigInstance.getApprovalMode.mockReturnValue(ApprovalMode.YOLO);
mockConfigInstance.getApprovalMode.mockReturnValue(ApprovalMode.DEFAULT);
const mockOnApprovalModeChange = vi.fn();
@@ -659,7 +647,7 @@ describe('useApprovalModeIndicator', () => {
});
expect(mockConfigInstance.setApprovalMode).toHaveBeenCalledWith(
ApprovalMode.YOLO,
ApprovalMode.DEFAULT,
);
// Should not throw an error when callback is not provided
});
@@ -689,7 +677,7 @@ describe('useApprovalModeIndicator', () => {
expect(mockOnApprovalModeChange).toHaveBeenCalledTimes(2);
expect(mockOnApprovalModeChange).toHaveBeenNthCalledWith(
1,
ApprovalMode.YOLO,
ApprovalMode.DEFAULT,
);
expect(mockOnApprovalModeChange).toHaveBeenNthCalledWith(
2,
@@ -103,7 +103,7 @@ describe('Scheduler Hooks', () => {
const mockConfig = createMockConfig({
getToolRegistry: () => toolRegistry,
getMessageBus: () => mockMessageBus,
getApprovalMode: () => ApprovalMode.YOLO,
getApprovalMode: () => ApprovalMode.DEFAULT,
});
const hookSystem = new HookSystem(mockConfig);
@@ -172,7 +172,7 @@ describe('Scheduler Hooks', () => {
const mockConfig = createMockConfig({
getToolRegistry: () => toolRegistry,
getMessageBus: () => mockMessageBus,
getApprovalMode: () => ApprovalMode.YOLO,
getApprovalMode: () => ApprovalMode.DEFAULT,
});
const hookSystem = new HookSystem(mockConfig);
@@ -243,7 +243,7 @@ describe('Scheduler Hooks', () => {
const mockConfig = createMockConfig({
getToolRegistry: () => toolRegistry,
getMessageBus: () => mockMessageBus,
getApprovalMode: () => ApprovalMode.YOLO,
getApprovalMode: () => ApprovalMode.DEFAULT,
});
const hookSystem = new HookSystem(mockConfig);
@@ -19,7 +19,6 @@ export function createMockWorkspaceContext(
): WorkspaceContext {
const allDirs = [rootDir, ...additionalDirs];
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
const mockWorkspaceContext = {
addDirectory: vi.fn(),
getDirectories: vi.fn().mockReturnValue(allDirs),