Merge pull request #28 from johndoe6345789/claude/fix-transpile-errors-aVFCx

Improve TypeScript types and test setup across frontend
This commit is contained in:
2026-02-01 17:55:10 +00:00
committed by GitHub
5 changed files with 33 additions and 9 deletions

View File

@@ -46,18 +46,29 @@ const mockUseDashboard = useDashboard as jest.MockedFunction<typeof useDashboard
describe('Dashboard Page', () => {
const defaultDashboardState = {
// Authentication
isAuthenticated: true,
authLoading: false,
handleLogout: jest.fn(),
// Container list
containers: [],
isRefreshing: false,
error: null,
isLoading: false,
error: '',
refreshContainers: jest.fn(),
// Terminal modal
selectedContainer: null,
isTerminalOpen: false,
openTerminal: jest.fn(),
closeTerminal: jest.fn(),
// UI state
isMobile: false,
isInitialLoading: false,
hasContainers: false,
showEmptyState: false,
handleLogout: jest.fn(),
};
beforeEach(() => {

1
frontend/jest.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
/// <reference types="@testing-library/jest-dom" />

View File

@@ -1,6 +1,14 @@
import { renderHook, act } from '@testing-library/react';
import { useInteractiveTerminal } from '../useInteractiveTerminal';
type UseInteractiveTerminalProps = {
open: boolean;
containerId: string;
containerName: string;
isMobile: boolean;
onFallback: (reason: string) => void;
};
// Suppress console output during tests (terminal initialization logs)
const originalConsoleLog = console.log;
const originalConsoleWarn = console.warn;
@@ -113,7 +121,7 @@ describe('useInteractiveTerminal', () => {
const mockDiv = document.createElement('div');
const { rerender } = renderHook(
(props) => {
(props: UseInteractiveTerminalProps) => {
const hook = useInteractiveTerminal(props);
// Simulate ref being available
if (hook.terminalRef.current === null) {

View File

@@ -11,14 +11,17 @@ import * as apiClient from '@/lib/api';
jest.mock('@/lib/api');
describe('authSlice', () => {
let store: ReturnType<typeof configureStore>;
type TestStore = ReturnType<typeof createTestStore>;
let store: TestStore;
const createTestStore = () => configureStore({
reducer: {
auth: authReducer,
},
});
beforeEach(() => {
store = configureStore({
reducer: {
auth: authReducer,
},
});
store = createTestStore();
jest.clearAllMocks();
localStorage.clear();
});

View File

@@ -24,6 +24,7 @@
},
"include": [
"next-env.d.ts",
"jest.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",